lkml.org 
[lkml]   [2024]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] crypto: qat - uninitialized variable in adf_hb_error_inject_write()
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


\
 
 \ /
  Last update: 2024-05-27 15:09    [W:0.078 / U:0.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site