public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Kees Cook <keescook@chromium.org>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Nuno Sá" <nuno.sa@analog.com>,
	linux-iio@vger.kernel.org,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"Bill Wendling" <morbo@google.com>,
	"Justin Stitt" <justinstitt@google.com>,
	llvm@lists.linux.dev, "Tomislav Denis" <tomislav.denis@avl.com>,
	linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes
Date: Sun, 25 Feb 2024 12:14:15 +0000	[thread overview]
Message-ID: <20240225121415.273ec110@jic23-huawei> (raw)
In-Reply-To: <202402230949.E06F3297@keescook>

On Fri, 23 Feb 2024 09:50:10 -0800
Kees Cook <keescook@chromium.org> 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


      reply	other threads:[~2024-02-25 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23 17:29 [PATCH v2] iio: pressure: dlhl60d: Initialize empty DLH bytes Kees Cook
2024-02-23 17:47 ` Andy Shevchenko
2024-02-23 17:49   ` Andy Shevchenko
2024-02-23 17:50   ` Kees Cook
2024-02-25 12:14     ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240225121415.273ec110@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=justinstitt@google.com \
    --cc=keescook@chromium.org \
    --cc=lars@metafoo.de \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nuno.sa@analog.com \
    --cc=tomislav.denis@avl.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox