* [vhost:vhost 24/24] drivers/firmware/qemu_fw_cfg.c:499:22: error: storage size of 'files' isn't known
@ 2018-02-14 20:27 kbuild test robot
[not found] ` <CAMxuvawhzjNA8gQSCpVtff-A6-Umg6fPz37nPhqRrDiRwKqUCQ@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2018-02-14 20:27 UTC (permalink / raw)
To: Marc-André Lureau
Cc: netdev, Michael S. Tsirkin, kbuild-all, kvm, virtualization
[-- Attachment #1: Type: text/plain, Size: 1905 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost
head: 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e
commit: 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e [24/24] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read
config: i386-randconfig-x015-201806 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
git checkout 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/firmware/qemu_fw_cfg.c: In function 'fw_cfg_register_dir_entries':
>> drivers/firmware/qemu_fw_cfg.c:499:22: error: storage size of 'files' isn't known
struct fw_cfg_files files;
^~~~~
drivers/firmware/qemu_fw_cfg.c:499:22: warning: unused variable 'files' [-Wunused-variable]
vim +499 drivers/firmware/qemu_fw_cfg.c
493
494 /* iterate over all fw_cfg directory entries, registering each one */
495 static int fw_cfg_register_dir_entries(void)
496 {
497 int ret = 0;
498 u32 count, i;
> 499 struct fw_cfg_files files;
500 struct fw_cfg_file *dir;
501 size_t dir_size;
502
503 fw_cfg_read_blob(FW_CFG_FILE_DIR, &files.count, 0, sizeof(files.count));
504 count = be32_to_cpu(files.count);
505 dir_size = count * sizeof(struct fw_cfg_file);
506
507 dir = kmalloc(dir_size, GFP_KERNEL);
508 if (!dir)
509 return -ENOMEM;
510
511 fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(files.count), dir_size);
512
513 for (i = 0; i < count; i++) {
514 ret = fw_cfg_register_file(&dir[i]);
515 if (ret)
516 break;
517 }
518
519 kfree(dir);
520 return ret;
521 }
522
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 32274 bytes --]
[-- Attachment #3: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [vhost:vhost 24/24] drivers/firmware/qemu_fw_cfg.c:499:22: error: storage size of 'files' isn't known
[not found] ` <CAMxuvawhzjNA8gQSCpVtff-A6-Umg6fPz37nPhqRrDiRwKqUCQ@mail.gmail.com>
@ 2018-02-15 18:26 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2018-02-15 18:26 UTC (permalink / raw)
To: Marc-Andre Lureau
Cc: kvm, netdev, virtualization, kbuild-all, Marc-André Lureau,
kbuild test robot
On Thu, Feb 15, 2018 at 10:46:50AM +0100, Marc-Andre Lureau wrote:
> Hi
>
> On Wed, Feb 14, 2018 at 9:27 PM, kbuild test robot
> <fengguang.wu@intel.com> wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git vhost
> > head: 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e
> > commit: 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e [24/24] fw_cfg: fix sparse warnings around FW_CFG_FILE_DIR read
> > config: i386-randconfig-x015-201806 (attached as .config)
> > compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> > reproduce:
> > git checkout 5d457fe6aeaab9d0a1665eafc8af7139bc6b6f2e
> > # save the attached .config to linux build tree
> > make ARCH=i386
> >
> > All errors (new ones prefixed by >>):
> >
> > drivers/firmware/qemu_fw_cfg.c: In function 'fw_cfg_register_dir_entries':
> >>> drivers/firmware/qemu_fw_cfg.c:499:22: error: storage size of 'files' isn't known
> > struct fw_cfg_files files;
> > ^~~~~
>
> struct fw_cfg_files {
> __be32 count; /* number of entries */
> struct fw_cfg_file f[];
> };
>
> Interesting, I don't have that warning with 7.3.1.
>
> I thought the size would be sizeof(count) by standard.
>
> I replaced it with a __be32 files_count variable instead.
>
> > drivers/firmware/qemu_fw_cfg.c:499:22: warning: unused variable 'files' [-Wunused-variable]
> >
>
> files.count is used 3 lines below, that looks like a compiler bug to me.
No - i tried dropping one patch out of series, this did not work out.
So whole series is out for now.
> > vim +499 drivers/firmware/qemu_fw_cfg.c
> >
> > 493
> > 494 /* iterate over all fw_cfg directory entries, registering each one */
> > 495 static int fw_cfg_register_dir_entries(void)
> > 496 {
> > 497 int ret = 0;
> > 498 u32 count, i;
> > > 499 struct fw_cfg_files files;
> > 500 struct fw_cfg_file *dir;
> > 501 size_t dir_size;
> > 502
> > 503 fw_cfg_read_blob(FW_CFG_FILE_DIR, &files.count, 0, sizeof(files.count));
> > 504 count = be32_to_cpu(files.count);
> > 505 dir_size = count * sizeof(struct fw_cfg_file);
> > 506
> > 507 dir = kmalloc(dir_size, GFP_KERNEL);
> > 508 if (!dir)
> > 509 return -ENOMEM;
> > 510
> > 511 fw_cfg_read_blob(FW_CFG_FILE_DIR, dir, sizeof(files.count), dir_size);
> > 512
> > 513 for (i = 0; i < count; i++) {
> > 514 ret = fw_cfg_register_file(&dir[i]);
> > 515 if (ret)
> > 516 break;
> > 517 }
> > 518
> > 519 kfree(dir);
> > 520 return ret;
> > 521 }
> > 522
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-02-15 18:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-14 20:27 [vhost:vhost 24/24] drivers/firmware/qemu_fw_cfg.c:499:22: error: storage size of 'files' isn't known kbuild test robot
[not found] ` <CAMxuvawhzjNA8gQSCpVtff-A6-Umg6fPz37nPhqRrDiRwKqUCQ@mail.gmail.com>
2018-02-15 18:26 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).