mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: "Cabiddu, Giovanni" <giovanni.cabiddu@intel.com>
Cc: Damian Muszynski <damian.muszynski@intel.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	Lucas Segarra Fernandez <lucas.segarra.fernandez@intel.com>,
	Tero Kristo <tero.kristo@linux.intel.com>,
	Markas Rapoportas <markas.rapoportas@intel.com>,
	qat-linux@intel.com, linux-crypto@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] crypto: qat - uninitialized variable in adf_hb_error_inject_write()
Date: Mon, 19 Feb 2024 08:45:54 +0300	[thread overview]
Message-ID: <42ad3d09-649c-4dc1-84e4-7aacd3f97ce0@moroto.mountain> (raw)
In-Reply-To: <Zc+Z7RBFNLcnzNOL@gcabiddu-mobl.ger.corp.intel.com>

On Fri, Feb 16, 2024 at 05:22:53PM +0000, Cabiddu, Giovanni wrote:
> > --- a/drivers/crypto/intel/qat/qat_common/adf_heartbeat_dbgfs.c
> > +++ b/drivers/crypto/intel/qat/qat_common/adf_heartbeat_dbgfs.c
> > @@ -160,16 +160,17 @@ static ssize_t adf_hb_error_inject_write(struct file *file,
> >  					 size_t count, loff_t *ppos)
> >  {
> >  	struct adf_accel_dev *accel_dev = file->private_data;
> > -	size_t written_chars;
> >  	char buf[3];
> >  	int ret;
> >  
> >  	/* last byte left as string termination */
> > -	if (count != 2)
> > +	if (*ppos != 0 || count != 2)
> Is this alone not sufficient to fix the problem? Probably I'm missing
> something.
> The function just checks the first character in buf.

I mean, technically, yes.

But leaving the last character uninitialized is ugly...  Using
simple_write_to_buffer() was inappropriate because it's not like this
code supported partial writes.  Better to just fix it all the way so no
one copy and pastes it somewhere else.

> 
> Anyway, looks correct to me.
> Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

Thanks!

regards,
dan carpenter


  reply	other threads:[~2024-02-19  5:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-13 18:09 Dan Carpenter
2024-02-16 17:22 ` Cabiddu, Giovanni
2024-02-19  5:45   ` Dan Carpenter [this message]
2024-02-24  0:50 ` Herbert Xu

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=42ad3d09-649c-4dc1-84e4-7aacd3f97ce0@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=damian.muszynski@intel.com \
    --cc=davem@davemloft.net \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucas.segarra.fernandez@intel.com \
    --cc=markas.rapoportas@intel.com \
    --cc=qat-linux@intel.com \
    --cc=tero.kristo@linux.intel.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®