Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp218750rdb; Thu, 8 Feb 2024 04:12:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVgglfTI5eZdzwo9Y/ozOKs9z3rFL2jvG1A4GSm0V2WjLr1I9MPhDPKy0EFvxES5afeWbXypRBzRxZsdJfUY6Nh2q68/LyLFZNcAMX4ig== X-Google-Smtp-Source: AGHT+IHiTRCbgokAaT6BirgeuiiKBUcELD3WM63NdT7juIgKAZL++KmNczNBFC5M2lhx3pX5nXBC X-Received: by 2002:a17:90a:2f47:b0:296:a375:cb86 with SMTP id s65-20020a17090a2f4700b00296a375cb86mr4971869pjd.14.1707394325550; Thu, 08 Feb 2024 04:12:05 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW0Fx+SHN4Ro1qipVXwGVKdaUNlKBh0eEf9qIHUV99JPoUqDZGDlF050SXGbFXWEE+IQ0qyKB8rNjeRHWSVfeU0W+wCakoD8kuxKN2U4g== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id sw13-20020a17090b2c8d00b00296bd36599asi1295306pjb.49.2024.02.08.04.12.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 04:12:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=uz3QtunK; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-58031-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58031-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2490F28CF27 for ; Thu, 8 Feb 2024 12:11:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A620971B48; Thu, 8 Feb 2024 12:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uz3QtunK" 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 C81D36BFC2; Thu, 8 Feb 2024 12:11:32 +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=1707394292; cv=none; b=bsFLrpSBr4vefHzr671qyQRGapRZ3m+80RpnnIjRQg/nAkLPN7eHHAbBIduhTNeGwnC5nMtSz45N6L7S8/gBqs0Om4IJgQtzgSHdrCVQL8FaRMboz2NhV/2evWnqwd1+LhzjIcxp7I1k0xdypAG4SGeYl8eAmCCvc+SysnxrExk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707394292; c=relaxed/simple; bh=Y5mb87bfIecKDPigGFFDcBn7FIohiyxS2vG0T0P/zF0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ibGpJ7ruDywLsw8yBtJRP5ft6A3iT8WKGmbE4Ngue/2seQ0l+djIKUkA5f1CluTjPa2iXPoB03zEaa80fzd+SO1Y8dW6Us6q9s5u8PudUSqkdOe6+I4+FlZu3k4QW6sfUczWhEpeG5pGp1MXTSFrYwL51dNpnX+HtMT98JsZK/I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uz3QtunK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EAF6C433F1; Thu, 8 Feb 2024 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707394292; bh=Y5mb87bfIecKDPigGFFDcBn7FIohiyxS2vG0T0P/zF0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uz3QtunKhCW+rx23zeGl0a4Y4+yjbToRCKcnRHh2AozrVZQrrWiBeSm7Z4WquCNCq qrsXs2xfQK4+Gn/QtbtJXDPToZC2wW/xbA8G8kg7S6DMOAqFH1iFdjC6jptoCq8wur PVK4Q9XEwL2o1B7CKe2AUsgJBZYdzYBc+g/HmfV0rCx5cc8Mi+pL4/wqTNr+NK1JYw jVd5rsJNyZ7gC8Rh4499PzBTdkJ4Lfbt8Qx1mn9WMYYdzUgcrYq/hviJOBslUKoHpn dfFpeSqXB4rGxHHXJrOMfM+7rBY7F5onzltGhLph5tzJlzUa0UPwZiL8Y/kdPQDnEK S+TKnYexIh4Pw== Date: Thu, 8 Feb 2024 12:11:28 +0000 From: Simon Horman To: Kees Cook Cc: Sam Creasey , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Gustavo A . R . Silva" , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH] net/sun3_82586: Avoid reading past buffer in debug output Message-ID: <20240208121128.GI1435458@kernel.org> References: <20240206161651.work.876-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240206161651.work.876-kees@kernel.org> On Tue, Feb 06, 2024 at 08:16:54AM -0800, Kees Cook wrote: > 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 > Cc: "David S. Miller" > Cc: Eric Dumazet > Cc: Jakub Kicinski > Cc: Paolo Abeni > Cc: Gustavo A. R. Silva > Cc: netdev@vger.kernel.org > Signed-off-by: Kees Cook Reviewed-by: Simon Horman Tested-by: Simon Horman # build-tested ..