Re: [bug report] io_uring: return iovec from __io_import_iovec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 08, 2021 at 03:19:21PM +0000, Pavel Begunkov wrote:
> On 11/8/21 13:49, Dan Carpenter wrote:
> > Hello Pavel Begunkov,
> > 
> > The patch caa8fe6e86fd: "io_uring: return iovec from
> > __io_import_iovec" from Oct 15, 2021, leads to the following Smatch
> > static checker warning:
> > 
> > 	fs/io_uring.c:3218 __io_import_iovec()
> > 	warn: passing zero to 'ERR_PTR'
> > 
> [...]
> >      3188
> >      3189         BUILD_BUG_ON(ERR_PTR(0) != NULL);
> > 
> > This is super paranoid.  :P
> 
> A bit, but gives an idea about assumptions
> 
> >      3209                 ret = import_single_range(rw, buf, sqe_len, s->fast_iov, iter);
> >      3210                 return ERR_PTR(ret);
> 
> if (ret)
> 	return ERR_PTR(ret);
> return NULL;
> 
> How about this? I have some hope in compilers, should be
> optimised out

The code is fine, but it's hard to know when it's going to return NULL
vs a valid pointer.  It just needs a comment.

regards,
dan carpenter




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux