All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Maíra Canal" <maira.canal@usp.br>
Cc: gregkh@linuxfoundation.org, tj@kernel.org,
	viro@zeniv.linux.org.uk, nathan@kernel.org,
	ndesaulniers@google.com, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: [PATCH v3] seq_file: fix NULL pointer arithmetic warning
Date: Tue, 1 Feb 2022 16:30:23 +0000	[thread overview]
Message-ID: <YflgH+uaoMJTlUoK@casper.infradead.org> (raw)
In-Reply-To: <Yfgo8p6Vk+h4+YHY@fedora>

On Mon, Jan 31, 2022 at 03:22:42PM -0300, Maíra Canal wrote:
> Implement conditional logic in order to replace NULL pointer arithmetic.
> 
> The use of NULL pointer arithmetic was pointed out by clang with the
> following warning:
> 
> fs/kernfs/file.c:128:15: warning: performing pointer arithmetic on a
> null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>                 return NULL + !*ppos;
>                        ~~~~ ^
> fs/seq_file.c:559:14: warning: performing pointer arithmetic on a
> null pointer has undefined behavior [-Wnull-pointer-arithmetic]
>         return NULL + (*pos == 0);
> 
> Signed-off-by: Maíra Canal <maira.canal@usp.br>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>

  parent reply	other threads:[~2022-02-01 16:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 18:22 [PATCH v3] seq_file: fix NULL pointer arithmetic warning Maíra Canal
2022-02-01 16:26 ` Nathan Chancellor
2022-02-01 16:30 ` Matthew Wilcox [this message]
2022-02-01 16:32 ` Al Viro

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=YflgH+uaoMJTlUoK@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=maira.canal@usp.br \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tj@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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.