All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: io-uring@vger.kernel.org
Subject: Re: [bug report] io_uring: return iovec from __io_import_iovec
Date: Mon, 8 Nov 2021 18:30:17 +0300	[thread overview]
Message-ID: <20211108153017.GF2026@kadam> (raw)
In-Reply-To: <d49a7d24-7cea-0b4a-b577-3fac16ddc5fb@gmail.com>

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


      reply	other threads:[~2021-11-08 15:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 13:49 [bug report] io_uring: return iovec from __io_import_iovec Dan Carpenter
2021-11-08 15:19 ` Pavel Begunkov
2021-11-08 15:30   ` Dan Carpenter [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=20211108153017.GF2026@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.