* [Xen-devel] [bug report] xen-pcifront: Xen PCI frontend driver.
@ 2019-06-25 12:31 Dan Carpenter
2019-06-25 13:26 ` Juergen Gross
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-06-25 12:31 UTC (permalink / raw)
To: xen-devel
Hi Xen devs,
I get the following static checker warning:
drivers/pci/xen-pcifront.c:107 schedule_pcifront_aer_op()
warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c
105 static inline void schedule_pcifront_aer_op(struct pcifront_device *pdev)
106 {
107 if (test_bit(_XEN_PCIB_active, (unsigned long *)&pdev->sh_info->flags)
->flags is a u32 so this cast only works on little endian systems. I
don't know if that matters at all. This driver has a bunch of similar
issues. Is Xen x86 only? It's pretty normal for Intel code to rely on
little endianness...
108 && !test_and_set_bit(_PDEVB_op_active, &pdev->flags)) {
109 dev_dbg(&pdev->xdev->dev, "schedule aer frontend job\n");
110 schedule_work(&pdev->op_work);
111 }
112 }
drivers/pci/xen-pcifront.c:107 schedule_pcifront_aer_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c:129 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'set_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c:142 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c:150 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c:162 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/pci/xen-pcifront.c:670 pcifront_do_aer() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
drivers/xen/mcelog.c:209 xen_mce_log() warn: passing casted pointer '&xen_mcelog.flags' to 'set_bit()' 32 vs 64.
drivers/xen/privcmd.c:350 mmap_batch_fn() warn: passing casted pointer 'gfnp' to 'xen_remap_domain_gfn_array()' 64 vs 32.
drivers/xen/privcmd.c:827 privcmd_ioctl_mmap_resource() warn: passing casted pointer 'pfns' to 'xen_remap_domain_mfn_array()' 64 vs 32.
drivers/xen/xen-pciback/conf_space.c:172 xen_pcibk_config_read() warn: passing casted pointer '&value' to 'pci_read_config_word()' 32 vs 16.
drivers/xen/xen-pciback/conf_space.c:57 conf_space_read() warn: passing casted pointer 'value' to 'field->u.w.read()' 32 vs 16.
drivers/xen/xen-pciback/pciback_ops.c:310 xen_pcibk_test_and_schedule_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pciback_ops.c:316 xen_pcibk_test_and_schedule_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pciback_ops.c:396 xen_pcibk_do_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:731 common_process() warn: passing casted pointer '&sh_info->flags' to 'set_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:736 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:741 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:745 common_process() warn: passing casted pointer '&sh_info->flags' to 'clear_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:753 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:799 xen_pcibk_slot_reset() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:857 xen_pcibk_mmio_enabled() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:916 xen_pcibk_error_detected() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
drivers/xen/xen-pciback/pci_stub.c:969 xen_pcibk_error_resume() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
regards,
dan carpenter
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Xen-devel] [bug report] xen-pcifront: Xen PCI frontend driver.
2019-06-25 12:31 [Xen-devel] [bug report] xen-pcifront: Xen PCI frontend driver Dan Carpenter
@ 2019-06-25 13:26 ` Juergen Gross
0 siblings, 0 replies; 2+ messages in thread
From: Juergen Gross @ 2019-06-25 13:26 UTC (permalink / raw)
To: Dan Carpenter, xen-devel
On 25.06.19 14:31, Dan Carpenter wrote:
> Hi Xen devs,
>
> I get the following static checker warning:
>
> drivers/pci/xen-pcifront.c:107 schedule_pcifront_aer_op()
> warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
>
> drivers/pci/xen-pcifront.c
> 105 static inline void schedule_pcifront_aer_op(struct pcifront_device *pdev)
> 106 {
> 107 if (test_bit(_XEN_PCIB_active, (unsigned long *)&pdev->sh_info->flags)
>
> ->flags is a u32 so this cast only works on little endian systems. I
> don't know if that matters at all. This driver has a bunch of similar
> issues. Is Xen x86 only? It's pretty normal for Intel code to rely on
> little endianness...
Xen is running on ARM, too. AFAIK it only supports little endian mode
for guests, though.
>
> 108 && !test_and_set_bit(_PDEVB_op_active, &pdev->flags)) {
> 109 dev_dbg(&pdev->xdev->dev, "schedule aer frontend job\n");
> 110 schedule_work(&pdev->op_work);
> 111 }
> 112 }
>
> drivers/pci/xen-pcifront.c:107 schedule_pcifront_aer_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/pci/xen-pcifront.c:129 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'set_bit()' 32 vs 64.
> drivers/pci/xen-pcifront.c:142 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/pci/xen-pcifront.c:150 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
> drivers/pci/xen-pcifront.c:162 do_pci_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/pci/xen-pcifront.c:670 pcifront_do_aer() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
> drivers/xen/mcelog.c:209 xen_mce_log() warn: passing casted pointer '&xen_mcelog.flags' to 'set_bit()' 32 vs 64.
> drivers/xen/privcmd.c:350 mmap_batch_fn() warn: passing casted pointer 'gfnp' to 'xen_remap_domain_gfn_array()' 64 vs 32.
> drivers/xen/privcmd.c:827 privcmd_ioctl_mmap_resource() warn: passing casted pointer 'pfns' to 'xen_remap_domain_mfn_array()' 64 vs 32.
> drivers/xen/xen-pciback/conf_space.c:172 xen_pcibk_config_read() warn: passing casted pointer '&value' to 'pci_read_config_word()' 32 vs 16.
> drivers/xen/xen-pciback/conf_space.c:57 conf_space_read() warn: passing casted pointer 'value' to 'field->u.w.read()' 32 vs 16.
> drivers/xen/xen-pciback/pciback_ops.c:310 xen_pcibk_test_and_schedule_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pciback_ops.c:316 xen_pcibk_test_and_schedule_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pciback_ops.c:396 xen_pcibk_do_op() warn: passing casted pointer '&pdev->sh_info->flags' to 'clear_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:731 common_process() warn: passing casted pointer '&sh_info->flags' to 'set_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:736 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:741 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:745 common_process() warn: passing casted pointer '&sh_info->flags' to 'clear_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:753 common_process() warn: passing casted pointer '&sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:799 xen_pcibk_slot_reset() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:857 xen_pcibk_mmio_enabled() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:916 xen_pcibk_error_detected() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
> drivers/xen/xen-pciback/pci_stub.c:969 xen_pcibk_error_resume() warn: passing casted pointer '&psdev->pdev->sh_info->flags' to 'test_bit()' 32 vs 64.
The sh_info->flags accesses would need to be modified in order to fix
the warnings. Either by adding *_bit32() variants to the kernel or by
using atomic() accesses instead.
Patches welcome. :-)
Juergen
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-25 13:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-25 12:31 [Xen-devel] [bug report] xen-pcifront: Xen PCI frontend driver Dan Carpenter
2019-06-25 13:26 ` Juergen Gross
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.