Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp789047rbb; Sun, 25 Feb 2024 04:14:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKl6A/7Vp+6tqS7ecRvToHQGcwURNKCN5uad1QYkl8fT4KQjT0HdIzakdo3+hSsVP1K88C8Pgxl0N9nrfGAoL/sEeI9jEBO5tBoxVE7A== X-Google-Smtp-Source: AGHT+IGH+oaYes6aMAUgM360SbItVYJQ+8I+CULMGmMR1B2qNC6/dOgfMOtA0lo48gDMCHmrOHPd X-Received: by 2002:a05:6402:1487:b0:565:21f1:4f27 with SMTP id e7-20020a056402148700b0056521f14f27mr3056562edv.23.1708863282472; Sun, 25 Feb 2024 04:14:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708863282; cv=pass; d=google.com; s=arc-20160816; b=dO91zQ165wE0mootxfCPsn+uTq5+ZPeEcT9p1jsueyNPGa123odxgCwdje6he0CYyM vK9uFF8fq08NeSPJ3sMcHQr1eR4+nKfjvM3kamBiDaef00c8pBGa7ja/+09O/9zXDUsm 9+ReYjaSymf2rd+HTkMyQXu1AwA28/3VhOZjcBfe1w6fjMR8haWE8SMW27D4lf1NkfPo kR7I4oU08A45Y5jtxOfruU4WmsJgaL3xVR4hoAOSMTRwgXJd+K4m/QYogCmSq0YYGKff 6tM7bq9zPnsVTxXmBVqhXBgzTw5Vq3Xzqq47PXr+59/Y0+5lawIfue70Y4BTw6vkdzoJ 9JGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=XjuJVtt7aggEkGiHTLKlTupCdw3l/W/MVSMzdzof/74=; fh=8H244haQuHReGIiAV7pd89c8p1lJ14J2XB3HFqlKLZg=; b=K/2PIF9L/THnQ2k+hHW4wIw8XVqyTpqbtEo6fSk0moaFDlEsrknknq9wLkdi49T6nO sRF1t43JG2dBs/wzFvLKBQX/aufCji06KcSeilrdL/22054grWshyHwk9haNJkJBlpgp wq206K0wcoXd6okUukrd2sFy6Lh3/+D8CCWhKuvdSKJFzaMf7H/HBEO6aZQULnKvUMpw zvaLTDKojU4w11dUIjzr/RHi8DeBwxjr93hljARekWrtT2+2MQk5TYGKZIlLjIOcI+cE yfKZ428lCMvZy0C9vScS6jllEIU//hT4kSLyP70gP4Z76ACQqPG0zVWMX34c2vlySGrM xVUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lAqHxAmn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80057-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h15-20020a056402280f00b00565b01131d7si1023579ede.213.2024.02.25.04.14.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 04:14:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lAqHxAmn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80057-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80057-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 25CB01F2161A for ; Sun, 25 Feb 2024 12:14:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 44ECD11C85; Sun, 25 Feb 2024 12:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lAqHxAmn" 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 6473CD528; Sun, 25 Feb 2024 12:14: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=1708863272; cv=none; b=FhCxRZ5CX/H58VVnF3y3LmcExjuXxdtOr4XNuh63VrSVSZoWjIF+OXR6Ugm7Kco9g4QRj/RrVStAJ+FtQIlTFsq2iS0QpJDZDqX1ysqB/AttzEJ3skjHeTosvu5A4VV+Gm0hSkslSpa2b+tmiS8fyqDeeqHv7MiV0UXLnirNNmw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708863272; c=relaxed/simple; bh=lYRiH0WxZt/e65XgOHzmCpT7ziP+FDLeHqqPGpHDKWw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t8Eku5dP4/3sSw4m1uh0jnVJG6PeRPLgay0zq2+1OVRi2hOhI/xW8jakuWzqivNMdf9hvPfxxB+zqWNt7Vy99kC0VnOVNUTHH4aAzewX35HlEd+m/XhTmB8+fgANbdOx07H8r09XigWLQ2I4pvEhtTj8UBFZKd7hh4Z/PfL6Fxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lAqHxAmn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93FF5C433C7; Sun, 25 Feb 2024 12:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708863271; bh=lYRiH0WxZt/e65XgOHzmCpT7ziP+FDLeHqqPGpHDKWw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lAqHxAmnwX+wQgFgMmo/WoutOetPW7LfjA51qEu/bIinx7PuGe4QFMBtzZ2pli1qe tCy69NXBD6bc06eLQCHF6upiWLbgyzUIq7Bc/rmxt8y/OrsDt2d/1Gbfas5NeMWXjq HtGzbG2er9uxpYTo8P8gzNrkj8dSRihiS35BEfYNMpCI3vK3un9emf/E9hTs2u/3Xu Jv+zllXJaSr0mtf72QAbYRbfK33P2eHSfNS2on2Kog45f0U6GsxTLtQYtCvkLVGUji Q2efWsaJGetOV5qclliApd73zJV/eNKvSZosBdavPMO39huBNmr5twTc3UpoVQNcrx UTJhqxwGiDHFw== Date: Sun, 25 Feb 2024 12:14:15 +0000 From: Jonathan Cameron To: Kees Cook Cc: Andy Shevchenko , Lars-Peter Clausen , Uwe =?UTF-8?B?S2xlaW5lLUvDtm5pZw==?= , Nuno =?UTF-8?B?U8Oh?= , linux-iio@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , llvm@lists.linux.dev, Tomislav Denis , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes Message-ID: <20240225121415.273ec110@jic23-huawei> In-Reply-To: <202402230949.E06F3297@keescook> References: <20240223172936.it.875-kees@kernel.org> <202402230949.E06F3297@keescook> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Fri, 23 Feb 2024 09:50:10 -0800 Kees Cook wrote: > On Fri, Feb 23, 2024 at 07:47:36PM +0200, Andy Shevchenko wrote: > > On Fri, Feb 23, 2024 at 09:29:39AM -0800, Kees Cook wrote: > > > 3 bytes were being read but 4 were being written. Explicitly initialize > > > the unused bytes to 0 and refactor the loop to use direct array > > > indexing, which appears to silence a Clang false positive warning[1]. > > > > ... > > > > > for_each_set_bit(chn, indio_dev->active_scan_mask, > > > - indio_dev->masklength) { > > > - memcpy(tmp_buf + i, > > > + indio_dev->masklength) { > > > + memcpy(&tmp_buf[i++], > > > &st->rx_buf[1] + chn * DLH_NUM_DATA_BYTES, > > > DLH_NUM_DATA_BYTES); > > > - i++; > > > } > > > > Not that I'm against the changes, but they (in accordance with the commit > > message) are irrelevant to this fix. I prefer fixes to be more focused on > > the real issues. > > Jonathan, let me know if you'd prefer I split this patch... > Andy is strictly speaking correct that the indent should be separate patch but meh - not worth the time to split that out + the change makes the fixed code itself easier to read. I added a tiny comment to say it the indent tidying up was incorporated so the fixed code was more readable. Applied to the fixes-togreg branch of iio.git and marked for stable. Given timing this may well go in during the merge window rather than before. Jonathan