From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4AAC2C190; Sun, 1 Sep 2024 17:02:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725210162; cv=none; b=W6jRDZGmMUIeE89kAJMJSPkWxGbTw6dXRQ0+ZsbfCDzLlYamQQpLFO6Tgo2fTxHGPYXBRW0bTBKsp3wCaZe36AFUwhEM735G/XC9DmCO4g0LOICyKJq2HXxHh5D1QeyyIOqAavPjej1JHR62cdKaVYfG8H76OuD/sUK5XbibXcI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725210162; c=relaxed/simple; bh=/sKXA4pvR3Kuchvu3NlDQDUbnqIT2Je5Gz9ZzpNaeuU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O8OoliZt6NiHECoyXTtQrL3MtTMj1umMkV/Dvm9pkdu8rav8lgvX+ZAhqLjKoyjV7hSxDQcNsLIoctgSbaaQ/m1jNWMxjSeOfjFo/3GIkFfeTuzLx7Mp15Jydktm9E+WhZ4tNpwAG5IxAoU+FOLpRhiVExxG+KY8EfyAnQqh2ko= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rFDXg1vU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="rFDXg1vU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569F6C4CEC3; Sun, 1 Sep 2024 17:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725210162; bh=/sKXA4pvR3Kuchvu3NlDQDUbnqIT2Je5Gz9ZzpNaeuU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rFDXg1vUSE9Q4jJMxNWnrdttL6oB6n6Nd4MKNsZUEkSIEG8/M46BoVhDjzrRB9DPl ZwuLB80DsNLrFz0E6OfF24sfGiBEl8WWpuWTLg+itQhyBtrZlQM4md1rDWja4r3z5e ynAtkFVQwd/PsmdqrL8jDSmwBWz5EtHzJFuc8ILs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sam Creasey , Kees Cook , Simon Horman , "Gustavo A. R. Silva" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 076/215] net/sun3_82586: Avoid reading past buffer in debug output Date: Sun, 1 Sep 2024 18:16:28 +0200 Message-ID: <20240901160826.225393612@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240901160823.230213148@linuxfoundation.org> References: <20240901160823.230213148@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kees Cook [ Upstream commit 4bea747f3fbec33c16d369b2f51e55981d7c78d0 ] Since NUM_XMIT_BUFFS is always 1, building m68k with sun3_defconfig and -Warraybounds, this build warning is visible[1]: drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout': drivers/net/ethernet/i825xx/sun3_82586.c:990:122: warning: array subscript 1 is above array bounds of 'volatile struct transmit_cmd_struct *[1]' [-Warray-bounds=] 990 | printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status)); | ~~~~~~~~~~~~^~~ ... drivers/net/ethernet/i825xx/sun3_82586.c:156:46: note: while referencing 'xmit_cmds' 156 | volatile struct transmit_cmd_struct *xmit_cmds[NUM_XMIT_BUFFS]; Avoid accessing index 1 since it doesn't exist. Link: https://github.com/KSPP/linux/issues/325 [1] Cc: Sam Creasey Signed-off-by: Kees Cook Reviewed-by: Simon Horman Tested-by: Simon Horman # build-tested Reviewed-by: Gustavo A. R. Silva Link: https://lore.kernel.org/r/20240206161651.work.876-kees@kernel.org Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/i825xx/sun3_82586.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/i825xx/sun3_82586.c b/drivers/net/ethernet/i825xx/sun3_82586.c index 18d32302c3c7a..6c89aa7eaa222 100644 --- a/drivers/net/ethernet/i825xx/sun3_82586.c +++ b/drivers/net/ethernet/i825xx/sun3_82586.c @@ -987,7 +987,7 @@ static void sun3_82586_timeout(struct net_device *dev, unsigned int txqueue) { #ifdef DEBUG printk("%s: xmitter timed out, try to restart! stat: %02x\n",dev->name,p->scb->cus); - printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status)); + printk("%s: command-stats: %04x\n", dev->name, swab16(p->xmit_cmds[0]->cmd_status)); printk("%s: check, whether you set the right interrupt number!\n",dev->name); #endif sun3_82586_close(dev); -- 2.43.0