From: Al Viro <viro@zeniv.linux.org.uk>
To: "Maíra Canal" <maira.canal@usp.br>
Cc: gregkh@linuxfoundation.org, tj@kernel.org, nathan@kernel.org,
ndesaulniers@google.com, willy@infradead.org,
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:32:27 +0000 [thread overview]
Message-ID: <Yflgm3kv1059tIDH@zeniv-ca.linux.org.uk> (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>
> ---
> V1 -> V2:
> - Use SEQ_START_TOKEN instead of open-coding it
> - kernfs_seq_start call single_start instead of open-coding it
> V2 -> V3:
> - Remove the EXPORT of the single_start symbol
Applied.
prev parent reply other threads:[~2022-02-01 16:32 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
2022-02-01 16:32 ` Al Viro [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=Yflgm3kv1059tIDH@zeniv-ca.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--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=willy@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox