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 C8E771C6F45; Tue, 27 Aug 2024 14:50:31 +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=1724770231; cv=none; b=QIwYN9foeP7O9irLUWkP7yQNX6o0jmon+Purizsfqcf0XPLHi028JmqsmCY2kZ3R9SqulN7v1TlMIUlPIxBqeI77PWO33J4egqbi9JgGG4cNglGxmznI/Yki9dhdyTLwlfTH1AVq6753ua1qqeSJTYOGi/N/2ctsfbtDSsjYzD8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724770231; c=relaxed/simple; bh=Gwn+XsmgRN+kdUtfpA9weenWQXUm4d6bm5T32u4wLHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BI5f2by9vLrtrVkl3tPSuSMOLyJAtPlQAUj2e0VMc+k4nEk6VmkO9Z6W7R74h5ypLYqqJH6Yoev5D3mDCgjoYW5EdLVziYQDRDMVDQAO7vxe44MfefEEOP+KO5HAi0vqQAFZ6fnAu8BPKlG4eFf8IE6XkZwW2b/bAy6834GjRso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cTjYYLEL; 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="cTjYYLEL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3646BC4DDF9; Tue, 27 Aug 2024 14:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1724770231; bh=Gwn+XsmgRN+kdUtfpA9weenWQXUm4d6bm5T32u4wLHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cTjYYLELpUX0yChxc6oX6gZ4lErfuMNAbo732XVE81v7HtSTM3wSpyWPudK/695BS QPUhv1Z1qth9x4A5L+8lbRgww+nBVCaJ9qg8QGC+Dxpha9GYBwGbplzHXYOdJ3V/Zz ipfx/6ISfwe/Okv/5lsmLov19KrnkSfPCchF3OpM= 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 6.6 167/341] net/sun3_82586: Avoid reading past buffer in debug output Date: Tue, 27 Aug 2024 16:36:38 +0200 Message-ID: <20240827143849.765877144@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240827143843.399359062@linuxfoundation.org> References: <20240827143843.399359062@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-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 5e27470c6b1ef..f2d4669c81cf2 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