All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [dhowells-fs:fscache-iter 23/33] fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here
       [not found] <201911140105.a5aulJde%lkp@intel.com>
@ 2019-11-13 20:21 ` Nick Desaulniers
  2019-11-14 12:53   ` David Howells
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Desaulniers @ 2019-11-13 20:21 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4665 bytes --]

On Wed, Nov 13, 2019 at 9:59 AM kbuild test robot <lkp@intel.com> wrote:
>
> CC: kbuild-all(a)lists.01.org
> TO: David Howells <dhowells@redhat.com>
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git fscache-iter
> head:   f62d2e3b55357b54ea4a541e85200ecdccfce7b4
> commit: b546e3179314dd9f56dd09047dfdaf93a2baada3 [23/33] fscache: Add read helper
> config: x86_64-rhel-7.6 (attached as .config)
> compiler: clang version 10.0.0 (git://gitmirror/llvm_project 335ac2eb662ce5f1888e2a50310b01fba2d40d68)
> reproduce:
>         git checkout b546e3179314dd9f56dd09047dfdaf93a2baada3
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here [-Wuninitialized]
>            x_flags |= fscache_shape_extent(req->io_handle, extent, i_size, false);
>            ^~~~~~~
>    fs/fscache/read_helper.c:239:23: note: initialize the variable 'x_flags' to silence this warning
>            unsigned char x_flags;
>                                 ^
>                                  = '\0'

Hi David, 0day bot flagged this from a Clang build. Warning looks
legit, can you please take a look?

>    1 warning generated.
>
> vim +/x_flags +258 fs/fscache/read_helper.c
>
>    209
>    210  /**
>    211   * fscache_read_helper - Helper to manage a read request
>    212   * @req: The initialised request structure to use
>    213   * @extent: The extent of the pages to access
>    214   * @requested_page: Singular page to include
>    215   * @pages: Unattached pages to include (readpages)
>    216   * @type: FSCACHE_READ_*
>    217   * @aop_flags: AOP_FLAG_*
>    218   *
>    219   * Read a sequence of pages appropriately sized for an fscache allocation
>    220   * block.  Pages are added at both ends and to fill in the gaps as appropriate
>    221   * to make it the right size.
>    222   *
>    223   * req->mapping should indicate the mapping to which the pages will be attached.
>    224   *
>    225   * The operations pointed to by req->ops will be used to issue or reissue a
>    226   * read against the server in case the cache is unavailable, incomplete or
>    227   * generates an error.  req->iter will be set up to point to the iterator
>    228   * representing the buffer to be filled in.
>    229   */
>    230  int fscache_read_helper(struct fscache_io_request *req,
>    231                          struct fscache_extent *extent,
>    232                          struct page **requested_page,
>    233                          struct list_head *pages,
>    234                          enum fscache_read_type type,
>    235                          unsigned int aop_flags)
>    236  {
>    237          struct address_space *mapping = req->mapping;
>    238          struct page *page;
>    239          unsigned char x_flags;
>    240          pgoff_t eof, cursor, start, first_index, trailer = ULONG_MAX;
>    241          loff_t i_size;
>    242          int ret;
>    243
>    244          first_index = extent->start;
>    245          _enter("{%lx,%lx}", first_index, extent->limit);
>    246
>    247          ASSERTIFCMP(requested_page && *requested_page,
>    248                      (*requested_page)->index, ==, first_index);
>    249          ASSERTIF(type == FSCACHE_READ_LOCKED_PAGE ||
>    250                   type == FSCACHE_READ_FOR_WRITE,
>    251                   pages == NULL);
>    252          ASSERTIFCMP(pages && !list_empty(pages),
>    253                      first_index, ==, lru_to_page(pages)->index);
>    254
>    255          i_size = i_size_read(mapping->host);
>    256          eof = (i_size + PAGE_SIZE - 1) >> PAGE_SHIFT;
>    257
>  > 258          x_flags |= fscache_shape_extent(req->io_handle, extent, i_size, false);
>
> ---
> 0-DAY kernel test infrastructure                 Open Source Technology Center
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe(a)googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/201911140105.a5aulJde%25lkp%40intel.com.



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dhowells-fs:fscache-iter 23/33] fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here
  2019-11-13 20:21 ` [dhowells-fs:fscache-iter 23/33] fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here Nick Desaulniers
@ 2019-11-14 12:53   ` David Howells
  0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2019-11-14 12:53 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Nick Desaulniers <ndesaulniers@google.com> wrote:

> Hi David, 0day bot flagged this from a Clang build. Warning looks
> legit, can you please take a look?

Yep.  I'm not sure why my compiler doesn't report these.

> > >> fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here [-Wuninitialized]
> >            x_flags |= fscache_shape_extent(req->io_handle, extent, i_size, false);

This should be "=" not "|=" and I've amended it accordingly, thanks.

David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-14 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201911140105.a5aulJde%lkp@intel.com>
2019-11-13 20:21 ` [dhowells-fs:fscache-iter 23/33] fs/fscache/read_helper.c:258:2: warning: variable 'x_flags' is uninitialized when used here Nick Desaulniers
2019-11-14 12:53   ` David Howells

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.