From patchwork Fri Nov 22 12:35:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Forissier X-Patchwork-Id: 844918 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:8b:b0:382:43a8:7b94 with SMTP id m11csp2825026wrx; Fri, 22 Nov 2024 04:36:25 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXPYNIegaj+2w9Qwl4cDkl0fFaTWBfqlJRtSGGVSi9hsIZk7zBDbojT34Ayt0+x0MfiFWjTqg==@linaro.org X-Google-Smtp-Source: AGHT+IG2meiFEizQN6qJcu5vZT8VW6D3lWU3JBeNEk4uGoVofR6l7k5SweOc0a7E/YNiG4fgJeP8 X-Received: by 2002:a2e:9a04:0:b0:2fb:3a12:a582 with SMTP id 38308e7fff4ca-2ffa712ae0bmr14891481fa.23.1732278985475; Fri, 22 Nov 2024 04:36:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732278985; cv=none; d=google.com; s=arc-20240605; b=hToqPRwKX4y/JC8aDZzstDd9pX8IsCPwfFd8iL3jIUabPi3PinWxkvHd25yk24vq3u Tw39OBshoYstRmDqonK0TUpoeXb7fCjZJ9dFNKVHFG1Fh0B6yc9pnqVZrG+JaenKYUU7 m/Kz2OIrH43875dFEo3WV8I3ZrRwPvMBo64iB5BOjfN0mcNuXGPBb9c6KJ6IR/wgP1NN Ai7oIrCAuSbQzm6/FaYGR1AkVAsEfUCGdMrrdVxa3i8YMFtF48gsYzjIVNsHuas5XwuV mNvrBjkbopiB4zm0sujW9y3dG4MllXkh5mTlk4hI2U6mZEhn+p99LSIkV+G48eOrAHY8 Qy+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=QRpNJEMFpEKsKomU991l22bFsXFhhOTzkVz/b1LCr9o=; fh=uC2rsdpvz+xFNWsqliG36faobH6VF7aIbsiDDGxvBNk=; b=hER8b7h+ZQFDqAudOv6JpUwOQ/fHpJyQdD3AqbIVPZAVVZ7myMbzOCvXuVbO9Vi/mx KAuVmilRgkxcC+IMv/m6GnX/4quLpZxbA/uCvnFg4SqjACLiKBg/PvGrN3bJb+/LiXD7 BsHbpanUelcObAVKvqiC+Fcvp3iGzRjBpcn/5vXuDa3QnzkKFRNVGgKvmvsxQwv+f8cm PyST3JYzmtV6lOcxnmQ6eYQof+2r6HaQO2wgFkvwi76jmQJr/a236lfTT8rsImvJYsCa 06DAoX8+sk8rTWzHTtKSrTMvNUtmKTg64dcpb3qUtUuY5/ZXnf9YJyiBNDd31/qNZdYz 8eSw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsKeGYdx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5d01d5251a3si1071888a12.335.2024.11.22.04.36.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 04:36:25 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tsKeGYdx; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8167D897F0; Fri, 22 Nov 2024 13:36:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="tsKeGYdx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A57508981E; Fri, 22 Nov 2024 13:36:23 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F06989339 for ; Fri, 22 Nov 2024 13:36:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=jerome.forissier@linaro.org Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-4315f24a6bbso16799595e9.1 for ; Fri, 22 Nov 2024 04:36:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732278981; x=1732883781; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=QRpNJEMFpEKsKomU991l22bFsXFhhOTzkVz/b1LCr9o=; b=tsKeGYdxojMYI0L07twE2fzfr1M7s9jvKCV0DLyFatCXFajBrUbNO39/ZOPKwVfPNo IUlogTxVNESQXR+Tv6TJh/BVf7TpINHjZt8P1UkIezG24suJMpCpD+hmtvSzb2NNFaBs lFoQIy54sLIzxA3eyl2B+sYqUAcdVi/9rNhtUmo2NA5ETyUawtwmDBDM9EmkdSxn8MyI wX49D21DwcMjwB8mkbexZKyl99Gxysf/FpZbntf2FhSiW9JXAZBK1HEUk6ebg/d9S4IC YZktiURkBeaXHDSsIvqSFAcRyI5rbFfF8nKPeBDRFDvlvwP2VaKkHr6kmUb+28wE9gP8 dGRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732278981; x=1732883781; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QRpNJEMFpEKsKomU991l22bFsXFhhOTzkVz/b1LCr9o=; b=GTTnFKzIkhI55JGrcxQJaO03rF7cfFaxdVxBjBSaxrZ2Ig+0olnL+T5w+w1DpyK9tu Q2/Er9cz3RONlZTogll0mbVMo4ikoiRILVhQ2Tfn/M+TJUA39g7pXNH2ipU5Sm7tdwA0 zuf15GPvrOKFBOgYvbz+x92CGFEDoNpUKYhE/p4V4JnT1vu0qweAD34UBYTPZbREHEvW 7jhoicpsYeJCTX4ey+eTdI8N/ZrOy6ZOpROBXl4BpkbZJZzhyUh3nDX/Te+OWC1y+b0P fKQIcE2iGbkTD0/qHQ/db0hhJuncVxwEJ1Wtvm0VLEh2QvXxN9e0NazMhW457HKJQwfl oAjg== X-Gm-Message-State: AOJu0Yy5QeuRypz1PBAIQLPjxXbJKsKShk3RzB3EBDLpSvB+aisMK/s3 ymkWaSUJcEHwE+lxWa3jGdPICTCcdHVp2Wv4v7ko3rZo2T1O449SYtEZTYCkMttjfHmGjKZmyWZ zKMs= X-Gm-Gg: ASbGncvHgR6HIjrctj/sskSe0DHNQSR+J4MJS0E4OtyDNRC5rhBObnAksJ68Dgy7TO3 /8Psw2ushkl8XPDcE2qO3Epcl2Itm5DBFrFvuFG1GszuVBXTpfnNKiQ8OoXN8E6x1ECbAj1vjJB nzkbgE8ZagD3bU48f+t73RIwLPDF9+X7nKyk8zXd61NEwF7s49JLJ+ArpcE0ykuKkREkX4KGURM NK3XXVqiqVc2LAweXKV4rLvv6sa+BIoVNP1otfdNipXJP8a1uScUdWIlnE= X-Received: by 2002:a05:600c:3b08:b0:426:5e91:3920 with SMTP id 5b1f17b1804b1-433ce4e9d8emr20735845e9.29.1732278980835; Fri, 22 Nov 2024 04:36:20 -0800 (PST) Received: from builder.. ([2a01:e0a:3cb:7bb0:328f:49bf:6d99:19be]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3825fd0fbdcsm2268917f8f.109.2024.11.22.04.36.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 04:36:20 -0800 (PST) From: Jerome Forissier To: u-boot@lists.denx.de Cc: Jerome Forissier , Ilias Apalodimas , Joe Hershberger , Ramon Fried , Tom Rini Subject: [PATCH] net: lwip: fix dhcp_loop() Date: Fri, 22 Nov 2024 13:35:29 +0100 Message-ID: <20241122123558.74702-1-jerome.forissier@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The local variables ipstr, maskstr and gwstr in static function dhcp_loop() cannot be pointers to read-only data, since they may be written to in case the device index is > 0. Therefore make them char arrays allocated on the stack. Reported-by: Ilias Apalodimas Signed-off-by: Jerome Forissier Reviewed-by: Ilias Apalodimas --- net/lwip/dhcp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/lwip/dhcp.c b/net/lwip/dhcp.c index 23b56226921..bfc72ca6c57 100644 --- a/net/lwip/dhcp.c +++ b/net/lwip/dhcp.c @@ -27,9 +27,9 @@ static void call_lwip_dhcp_fine_tmr(void *ctx) static int dhcp_loop(struct udevice *udev) { - char *ipstr = "ipaddr\0\0"; - char *maskstr = "netmask\0\0"; - char *gwstr = "gatewayip\0\0"; + char ipstr[] = "ipaddr\0\0"; + char maskstr[] = "netmask\0\0"; + char gwstr[] = "gatewayip\0\0"; unsigned long start; struct netif *netif; struct dhcp *dhcp;