mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Maxwell Doose <m32285159@gmail.com>
Cc: Dan Carpenter <error27@gmail.com>, Nuno Sa <nuno.sa@analog.com>,
	Olivier Moysan <olivier.moysan@foss.st.com>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] iio: backend: fix uninitialized data in debugfs
Date: Tue, 26 May 2026 19:19:46 +0100	[thread overview]
Message-ID: <20260526191946.409160c8@jic23-huawei> (raw)
In-Reply-To: <CAKqfh0En4pHqSfxfd2FHSDTxfWx6BfJLfeQ3xup4bwfLSTrZRA@mail.gmail.com>

On Mon, 25 May 2026 08:20:31 -0500
Maxwell Doose <m32285159@gmail.com> wrote:

> On Mon, May 25, 2026 at 2:17 AM Dan Carpenter <error27@gmail.com> wrote:
> >
> > If the *ppos value is non-zero then simple_write_to_buffer() will not
> > initialize the start of the buf[] buffer.  Non-zero ppos values aren't
> > going to work at all.  Check for that at the start of the function and
> > return -EINVAL.
> >  
> 
> Commit message is incorrect, it looks like you're returning -ENOSPC here...
Tweaked and applied to the fixes-togreg branch of iio.git + marked for stable.

thanks,

J
> 
> >
> > Fixes: cdf01e0809a4 ("iio: backend: add debugFs interface")
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
> > ---
> >  drivers/iio/industrialio-backend.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-backend.c
> > index 138ebebc9c0d..4763e224ebc6 100644
> > --- a/drivers/iio/industrialio-backend.c
> > +++ b/drivers/iio/industrialio-backend.c
> > @@ -156,7 +156,7 @@ static ssize_t iio_backend_debugfs_write_reg(struct file *file,
> >         ssize_t rc;
> >         int ret;
> >
> > -       if (count >= sizeof(buf))
> > +       if (*ppos != 0 || count >= sizeof(buf))
> >                 return -ENOSPC;
> >  
> 
> See above comment.
> 
> best regards,
> max
> 
> 
> >
> >         rc = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, userbuf, count);
> > --
> > 2.53.0
> >
> >  


  reply	other threads:[~2026-05-26 18:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-25  7:16 Dan Carpenter
2026-05-25 13:20 ` Maxwell Doose
2026-05-26 18:19   ` Jonathan Cameron [this message]
2026-06-04  7:30     ` Andy Shevchenko
2026-06-04  7:38       ` Andy Shevchenko
2026-06-04  7:45       ` Dan Carpenter
2026-06-04  8:03         ` Andy Shevchenko
2026-06-04  8:28           ` Andy Shevchenko
2026-06-04 10:38             ` Dan Carpenter
2026-06-04 10:42               ` Dan Carpenter
2026-06-04 14:55                 ` Andy Shevchenko
2026-06-05  6:12                   ` Dan Carpenter
2026-06-05  8:28                     ` Andy Shevchenko
2026-06-05 14:38                       ` Maxwell Doose
2026-06-08 20:31                       ` Nuno Sá
2026-06-08 21:51                         ` Maxwell Doose
2026-06-09  8:10                           ` Nuno Sá
2026-06-09 12:16                             ` Andy Shevchenko
2026-06-09 13:09                             ` Jonathan Cameron
2026-06-09  6:21                         ` Dan Carpenter
2026-06-09  6:19                       ` Dan Carpenter
2026-06-10 10:41                         ` Andy Shevchenko
2026-06-10 12:19                           ` Dan Carpenter
2026-06-10 13:44                             ` Andy Shevchenko
2026-06-04 14:52               ` Andy Shevchenko

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=20260526191946.409160c8@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m32285159@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.com \
    /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

all inboxes | Powered by JetHome®