From: Suren Baghdasaryan <surenb@google.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev, lkp@intel.com,
oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
Kent Overstreet <kent.overstreet@linux.dev>
Subject: Re: [linux-next:master 2720/3921] lib/alloc_tag.c:142 alloc_tag_init() warn: passing zero to 'PTR_ERR'
Date: Tue, 16 Apr 2024 17:36:13 -0700 [thread overview]
Message-ID: <CAJuCfpH5VfxT+JNK9DmhDwYYiOVCxAuRvPgGnLVRK-=nt6TfuQ@mail.gmail.com> (raw)
In-Reply-To: <CAJuCfpE-YoTONXC-SYPfcjiMbfN64s9XScO_v-SAo0brB=6i1A@mail.gmail.com>
On Tue, Apr 16, 2024 at 4:57 PM Suren Baghdasaryan <surenb@google.com> wrote:
>
> On Fri, Apr 5, 2024 at 6:51 AM Dan Carpenter <dan.carpenter@linaro.org> wrote:
> >
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> > head: 8568bb2ccc278f344e6ac44af6ed010a90aa88dc
> > commit: 9e2dcefa791e9d14006b360fba3455510fd3325d [2720/3921] lib: add allocation tagging support for memory allocation profiling
> > config: microblaze-randconfig-r081-20240405 (https://download.01.org/0day-ci/archive/20240405/202404051340.7Wo7oiJ5-lkp@intel.com/config)
> > compiler: microblaze-linux-gcc (GCC) 13.2.0
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > | Closes: https://lore.kernel.org/r/202404051340.7Wo7oiJ5-lkp@intel.com/
> >
> > smatch warnings:
> > lib/alloc_tag.c:142 alloc_tag_init() warn: passing zero to 'PTR_ERR'
> >
> > vim +/PTR_ERR +142 lib/alloc_tag.c
> >
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 132 static int __init alloc_tag_init(void)
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 133 {
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 134 const struct codetag_type_desc desc = {
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 135 .section = "alloc_tags",
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 136 .tag_size = sizeof(struct alloc_tag),
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 137 .module_unload = alloc_tag_module_unload,
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 138 };
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 139
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 140 alloc_tag_cttype = codetag_register_type(&desc);
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 141 if (IS_ERR_OR_NULL(alloc_tag_cttype))
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > This should just be IS_ERR(). I have written a blog that has more
> > details:
> >
> > https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
>
> Sorry for the delay, I somehow missed this report. You are absolutely
> right about the fix. codetag_register_type() never returns NULL, so
> IS_ERR() should be used here. I'll post a fix shortly.
Here: https://lore.kernel.org/all/20240417003349.2520094-1-surenb@google.com/
> Thanks,
> Suren.
>
> >
> > 9e2dcefa791e9d Suren Baghdasaryan 2024-03-21 @142 return PTR_ERR(alloc_tag_cttype);
> >
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> >
prev parent reply other threads:[~2024-04-17 0:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 6:51 Dan Carpenter
2024-04-16 23:57 ` Suren Baghdasaryan
2024-04-17 0:36 ` Suren Baghdasaryan [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='CAJuCfpH5VfxT+JNK9DmhDwYYiOVCxAuRvPgGnLVRK-=nt6TfuQ@mail.gmail.com' \
--to=surenb@google.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@linaro.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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