search for: build_bug_on

Displaying 20 results from an estimated 545 matches for "build_bug_on".

2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...i_modern.c @@ -470,6 +470,67 @@ static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type, return 0; } +/* This is part of the ABI. Don't screw with it. */ +static inline void check_offsets(void) +{ + /* Note: disk space was harmed in compilation of this function. */ + BUILD_BUG_ON(VIRTIO_PCI_CAP_VNDR != + offsetof(struct virtio_pci_cap, cap_vndr)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_NEXT != + offsetof(struct virtio_pci_cap, cap_next)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != + offsetof(struct virtio_pci_cap, cap_len)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR !=...
2014 Dec 30
0
[PATCH RFC v2 6/7] virtio_pci: macros for PCI layout offsets.
...i_modern.c @@ -470,6 +470,67 @@ static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type, return 0; } +/* This is part of the ABI. Don't screw with it. */ +static inline void check_offsets(void) +{ + /* Note: disk space was harmed in compilation of this function. */ + BUILD_BUG_ON(VIRTIO_PCI_CAP_VNDR != + offsetof(struct virtio_pci_cap, cap_vndr)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_NEXT != + offsetof(struct virtio_pci_cap, cap_next)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != + offsetof(struct virtio_pci_cap, cap_len)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR !=...
2013 May 30
5
[PATCH RFC] virtio-pci: new config layout: using memory BAR
...gt; GCC does the right thing. But this isn't kernel land anymore, > portability matters and there are more compilers than GCC. [ I argued in detail here, then deleted. Damn bikeshedding... ] I think the best thing is to add the decoded integer versions as macros, and have a heap of BUILD_BUG_ON() in the kernel source to make sure they match. > 3) It suspect it's harder to review because a subtle change could more > easily have broad impact. If someone changed the type of a field > from u32 to u16, it changes the offset of every other field. That's > not ter...
2013 May 30
5
[PATCH RFC] virtio-pci: new config layout: using memory BAR
...gt; GCC does the right thing. But this isn't kernel land anymore, > portability matters and there are more compilers than GCC. [ I argued in detail here, then deleted. Damn bikeshedding... ] I think the best thing is to add the decoded integer versions as macros, and have a heap of BUILD_BUG_ON() in the kernel source to make sure they match. > 3) It suspect it's harder to review because a subtle change could more > easily have broad impact. If someone changed the type of a field > from u32 to u16, it changes the offset of every other field. That's > not ter...
2020 Aug 24
3
[PATCH v6 02/76] KVM: SVM: Add GHCB definitions
On Mon, Aug 24, 2020 at 10:53:57AM +0200, Joerg Roedel wrote: > static inline void __unused_size_checks(void) > { > - BUILD_BUG_ON(sizeof(struct vmcb_save_area) != 0x298); > + BUILD_BUG_ON(sizeof(struct vmcb_save_area) != 1032); > BUILD_BUG_ON(sizeof(struct vmcb_control_area) != 256); > + BUILD_BUG_ON(sizeof(struct ghcb) != 4096); Could those naked numbers be proper, meaningfully named defines? -- Regards/Gruss,...
2020 Aug 24
3
[PATCH v6 02/76] KVM: SVM: Add GHCB definitions
On Mon, Aug 24, 2020 at 10:53:57AM +0200, Joerg Roedel wrote: > static inline void __unused_size_checks(void) > { > - BUILD_BUG_ON(sizeof(struct vmcb_save_area) != 0x298); > + BUILD_BUG_ON(sizeof(struct vmcb_save_area) != 1032); > BUILD_BUG_ON(sizeof(struct vmcb_control_area) != 256); > + BUILD_BUG_ON(sizeof(struct ghcb) != 4096); Could those naked numbers be proper, meaningfully named defines? -- Regards/Gruss,...
2019 Sep 11
0
[vhost:linux-next 8/9] drivers/vhost/vhost.c:2076:5: note: in expansion of macro 'array_index_nospec'
...it.h:7, from include/linux/eventfd.h:13, from drivers/vhost/vhost.c:13: drivers/vhost/vhost.c: In function 'translate_desc': >> include/linux/compiler.h:350:38: error: call to '__compiletime_assert_2077' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long) _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) ^ include/linux/compiler.h:331:4: note: in definition of macro '__compiletime_assert' prefix ## suffix(); \ ^~~~~~ i...
2017 Feb 15
1
[PATCH] average: change to declare precision, not factor
...wer of two for efficiency. + */ -#define DECLARE_EWMA(name, _factor, _weight) \ +#define DECLARE_EWMA(name, _precision, _weight_rcp) \ struct ewma_##name { \ unsigned long internal; \ }; \ static inline void ewma_##name##_init(struct ewma_##name *e) \ { \ - BUILD_BUG_ON(!__builtin_constant_p(_factor)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight)); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_factor); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight); \ + BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ + BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ + /*...
2017 Feb 15
1
[PATCH] average: change to declare precision, not factor
...wer of two for efficiency. + */ -#define DECLARE_EWMA(name, _factor, _weight) \ +#define DECLARE_EWMA(name, _precision, _weight_rcp) \ struct ewma_##name { \ unsigned long internal; \ }; \ static inline void ewma_##name##_init(struct ewma_##name *e) \ { \ - BUILD_BUG_ON(!__builtin_constant_p(_factor)); \ - BUILD_BUG_ON(!__builtin_constant_p(_weight)); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_factor); \ - BUILD_BUG_ON_NOT_POWER_OF_2(_weight); \ + BUILD_BUG_ON(!__builtin_constant_p(_precision)); \ + BUILD_BUG_ON(!__builtin_constant_p(_weight_rcp)); \ + /*...
2014 Dec 17
2
[PATCH 01/10] core: Split out UFO6 support
...inux/netdevice.h b/include/linux/netdevice.h > index 74fd5d3..86af10a 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -3559,6 +3559,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) > /* check flags correspondence */ > BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); > BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT)); > + BUILD_BUG_ON(SKB_GSO_UDP6 != (NETIF_F_UFO6 >> NETIF_F_GSO_SHIFT)); > BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETI...
2014 Dec 17
2
[PATCH 01/10] core: Split out UFO6 support
...inux/netdevice.h b/include/linux/netdevice.h > index 74fd5d3..86af10a 100644 > --- a/include/linux/netdevice.h > +++ b/include/linux/netdevice.h > @@ -3559,6 +3559,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type) > /* check flags correspondence */ > BUILD_BUG_ON(SKB_GSO_TCPV4 != (NETIF_F_TSO >> NETIF_F_GSO_SHIFT)); > BUILD_BUG_ON(SKB_GSO_UDP != (NETIF_F_UFO >> NETIF_F_GSO_SHIFT)); > + BUILD_BUG_ON(SKB_GSO_UDP6 != (NETIF_F_UFO6 >> NETIF_F_GSO_SHIFT)); > BUILD_BUG_ON(SKB_GSO_DODGY != (NETIF_F_GSO_ROBUST >> NETI...
2008 Dec 11
0
[PATCH] change BUILD_BUG_ON()
...en/include/xen/lib.h 2007-09-10 09:59:38.000000000 +0200 +++ 2008-11-20/xen/include/xen/lib.h 2008-12-11 09:54:51.000000000 +0100 @@ -16,7 +16,7 @@ void __warn(char *file, int line); #define WARN_ON(p) do { if (p) WARN(); } while (0) /* Force a compilation error if condition is true */ -#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(condition)])) +#define BUILD_BUG_ON(condition) ((void)sizeof(struct { int:-!!(condition); })) #ifndef assert_failed #define assert_failed(p) \ _______________________________________________ Xen-devel mailing li...
2014 Dec 11
6
[PATCH RFC 0/5] virtio_pci: modern driver
Based on Rusty's patches. Coding style and funny jokes are his. Bugs and a star wars reference (should be easy to spot) are mine. Untested, but useful as basis for beginning the qemu work. TODO: = simplify probing: use a common probe function, probe with modern driver first, if that fails - probe with legacy driver. BUGS: ATM legacy driver can win and drive a transitional device
2014 Dec 11
6
[PATCH RFC 0/5] virtio_pci: modern driver
Based on Rusty's patches. Coding style and funny jokes are his. Bugs and a star wars reference (should be easy to spot) are mine. Untested, but useful as basis for beginning the qemu work. TODO: = simplify probing: use a common probe function, probe with modern driver first, if that fails - probe with legacy driver. BUGS: ATM legacy driver can win and drive a transitional device
2014 Sep 14
3
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
On Sun, Sep 14, 2014 at 07:04:11AM -0700, Peter Maydell wrote: > On 14 September 2014 06:46, Michael S. Tsirkin <mst at redhat.com> wrote: > > BUILD_BUG_ON in linux, QEMU_BUILD_BUG_ON in QEMU. > > You have to stick it in a C file though, so it > > won't be visible in this patch. > > Why do you think that? We have several header files which > use QEMU_BUILD_BUG_ON and I don't see any reason why > it would have to be inv...
2014 Sep 14
3
[Qemu-devel] [PATCH 1/2] virtio-gpu/2d: add hardware spec include file
On Sun, Sep 14, 2014 at 07:04:11AM -0700, Peter Maydell wrote: > On 14 September 2014 06:46, Michael S. Tsirkin <mst at redhat.com> wrote: > > BUILD_BUG_ON in linux, QEMU_BUILD_BUG_ON in QEMU. > > You have to stick it in a C file though, so it > > won't be visible in this patch. > > Why do you think that? We have several header files which > use QEMU_BUILD_BUG_ON and I don't see any reason why > it would have to be inv...
2020 Jun 08
2
[PATCH] virtio-mem: drop unnecessary initialization
...e9149be..2f357142ea5e 100644 --- a/drivers/virtio/virtio_mem.c +++ b/drivers/virtio/virtio_mem.c @@ -1768,7 +1768,7 @@ static void virtio_mem_delete_resource(struct virtio_mem *vm) static int virtio_mem_probe(struct virtio_device *vdev) { struct virtio_mem *vm; - int rc = -EINVAL; + int rc; BUILD_BUG_ON(sizeof(struct virtio_mem_req) != 24); BUILD_BUG_ON(sizeof(struct virtio_mem_resp) != 10); -- MST
2015 Jan 20
0
[PATCH 03/05] fixup! virtio_pci: macros for PCI layout offsets
.../drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index c86594e..b2e707ad 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -474,8 +474,10 @@ static inline void check_offsets(void) offsetof(struct virtio_pci_cap, cap_next)); BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != offsetof(struct virtio_pci_cap, cap_len)); - BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR != - offsetof(struct virtio_pci_cap, type_and_bar)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_CFG_TYPE != + offsetof(struct virtio_pci_cap, cfg_type)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_...
2015 Jan 20
0
[PATCH 03/05] fixup! virtio_pci: macros for PCI layout offsets
.../drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index c86594e..b2e707ad 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -474,8 +474,10 @@ static inline void check_offsets(void) offsetof(struct virtio_pci_cap, cap_next)); BUILD_BUG_ON(VIRTIO_PCI_CAP_LEN != offsetof(struct virtio_pci_cap, cap_len)); - BUILD_BUG_ON(VIRTIO_PCI_CAP_TYPE_AND_BAR != - offsetof(struct virtio_pci_cap, type_and_bar)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_CFG_TYPE != + offsetof(struct virtio_pci_cap, cfg_type)); + BUILD_BUG_ON(VIRTIO_PCI_CAP_...
2014 Mar 17
2
[PATCH] virtio-blk: make the queue depth configurable
...odconfig with this > now: Good idea. > diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h [] > @@ -188,6 +188,9 @@ struct kparam_array > /* Default value instead of permissions? */ \ > static int __param_perm_check_##name __attribute__((unused)) = \ > BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ > + /* User perms >= group perms >= other perms. */ \ > + + BUILD_BUG_ON_ZERO(((perm) >> 6) < (((perm) >> 3) & 7)) \ > + + BUILD_BUG_ON_ZERO((((perm) >> 3) & 7) < ((perm) & 7)) \ >...