search for: __alignof__

Displaying 20 results from an estimated 74 matches for "__alignof__".

2023 Aug 16
1
[Bridge] [PATCH net-next v2] netfilter: ebtables: replace zero-length array members
...ables.h index b0caad82b693..673b00df162c 100644 --- a/include/uapi/linux/netfilter_bridge/ebtables.h +++ b/include/uapi/linux/netfilter_bridge/ebtables.h @@ -87,7 +87,7 @@ struct ebt_entries { /* nr. of entries */ unsigned int nentries; /* entry list */ - char data[0] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); + char data[] __attribute__ ((aligned (__alignof__(struct ebt_replace)))); }; /* used for the bitmask of struct ebt_entry */ @@ -129,7 +129,7 @@ struct ebt_entry_match { } u; /* size of data */ unsigned int match_size; - unsigned char data[0] __attribute__ ((aligne...
2019 Oct 17
2
Static assert fails when compiler for i386
...diff --git a/clang/lib/Headers/__stddef_max_align_t.h b/clang/lib/Headers/__stddef_max_align_t.h index e3b439285d0..46f705a09c3 100644 --- a/clang/lib/Headers/__stddef_max_align_t.h +++ b/clang/lib/Headers/__stddef_max_align_t.h @@ -21,6 +21,10 @@ typedef struct { __attribute__((__aligned__(__alignof__(long long)))); long double __clang_max_align_nonce2 __attribute__((__aligned__(__alignof__(long double)))); + #ifdef __i386__ + typedef double xx __attribute__((vector_size(16))); + xx __clang_max_align_nonce3 __attribute__((__aligned__(__alignof__(xx)))); + #endif } max_align_t; #...
2014 Dec 20
0
[PATCH] vhost: relax used address alignment
...ev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + BUILD_BUG_ON(__alignof__ *vq->avail != 2); + BUILD_BUG_ON(__alignof__ *vq->used != 4); + if ((a.avail_user_addr & (__alignof__ *vq->avail - 1)) || + (a.used_user_addr & (__alignof__ *vq->used - 1)) || + (a.log_guest_addr & (sizeof(u64) - 1))) { r = -EINVAL; break; } -- MST
2014 Dec 20
0
[PATCH] vhost: relax used address alignment
...ev *d, int ioctl, void __user *argp) r = -EFAULT; break; } - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + BUILD_BUG_ON(__alignof__ *vq->avail != 2); + BUILD_BUG_ON(__alignof__ *vq->used != 4); + if ((a.avail_user_addr & (__alignof__ *vq->avail - 1)) || + (a.used_user_addr & (__alignof__ *vq->used - 1)) || + (a.log_guest_addr & (sizeof(u64) - 1))) { r = -EINVAL; break; } -- MST
2015 Sep 16
2
vhost: build failure
Hi, While crosscompiling the kernel for openrisc with allmodconfig the build failed with the error: drivers/vhost/vhost.c: In function 'vhost_vring_ioctl': drivers/vhost/vhost.c:818:3: error: call to '__compiletime_assert_818' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE Can you please give me any idea about what the problem might be and how it can be solved. You can see the build log at: https://travis-ci.org/sudipm-mukherjee/parport/jobs/80365425 regards sudip
2015 Sep 16
2
vhost: build failure
Hi, While crosscompiling the kernel for openrisc with allmodconfig the build failed with the error: drivers/vhost/vhost.c: In function 'vhost_vring_ioctl': drivers/vhost/vhost.c:818:3: error: call to '__compiletime_assert_818' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE Can you please give me any idea about what the problem might be and how it can be solved. You can see the build log at: https://travis-ci.org/sudipm-mukherjee/parport/jobs/80365425 regards sudip
2016 Jul 04
2
Build regressions/improvements in v4.7-rc6
...oeven <geert at linux-m68k.org> wrote: > JFYI, when comparing v4.7-rc6[1] to v4.7-rc5[3], the summaries are: > - build errors: +3/-2 + /home/kisskb/slave/src/drivers/vhost/vhost.c: error: call to '__compiletime_assert_844' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE: => 844:3 arm-randconfig > [1] http://kisskb.ellerman.id.au/kisskb/head/10562/ (260 out of 263 configs) > [3] http://kisskb.ellerman.id.au/kisskb/head/10532/ (260 out of 263 configs) Gr{oetje,eeting}s, Geert -- Geert U...
2016 Jul 04
2
Build regressions/improvements in v4.7-rc6
...oeven <geert at linux-m68k.org> wrote: > JFYI, when comparing v4.7-rc6[1] to v4.7-rc5[3], the summaries are: > - build errors: +3/-2 + /home/kisskb/slave/src/drivers/vhost/vhost.c: error: call to '__compiletime_assert_844' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE: => 844:3 arm-randconfig > [1] http://kisskb.ellerman.id.au/kisskb/head/10562/ (260 out of 263 configs) > [3] http://kisskb.ellerman.id.au/kisskb/head/10532/ (260 out of 263 configs) Gr{oetje,eeting}s, Geert -- Geert U...
2017 Nov 02
2
Possible unsafe usage of skb->cb in virtio-net
...is bug too. > > You must fix this properly, by keeping track of an offset or similar > internally to your driver, rather than changing the SKB data pointers. What virtio does is this: can_push = vi->any_header_sg && !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) && !skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len; /* Even if we can, don't push here yet as this would skew * csum_start offset below. */ if (can_push) hdr = (struct virtio_net_hdr_mrg_rxbuf *)(skb...
2017 Nov 02
2
Possible unsafe usage of skb->cb in virtio-net
...is bug too. > > You must fix this properly, by keeping track of an offset or similar > internally to your driver, rather than changing the SKB data pointers. What virtio does is this: can_push = vi->any_header_sg && !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) && !skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len; /* Even if we can, don't push here yet as this would skew * csum_start offset below. */ if (can_push) hdr = (struct virtio_net_hdr_mrg_rxbuf *)(skb...
2015 Nov 16
1
[PATCH] vhost: relax log address alignment
...file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index eec2f11..080422f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || - (a.log_guest_addr & (sizeof(u64) - 1))) { + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { r = -EINV...
2016 Jul 04
0
Build regressions/improvements in v4.7-rc6
...org> wrote: > > JFYI, when comparing v4.7-rc6[1] to v4.7-rc5[3], the summaries are: > > - build errors: +3/-2 > > + /home/kisskb/slave/src/drivers/vhost/vhost.c: error: call to > '__compiletime_assert_844' declared with attribute error: BUILD_BUG_ON > failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE: => 844:3 > > arm-randconfig > > > [1] http://kisskb.ellerman.id.au/kisskb/head/10562/ (260 out of 263 configs) > > [3] http://kisskb.ellerman.id.au/kisskb/head/10532/ (260 out of 263 configs) I don't see any changes in the c...
2015 Nov 16
1
[PATCH] vhost: relax log address alignment
...file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index eec2f11..080422f 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -819,7 +819,7 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp) BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || - (a.log_guest_addr & (sizeof(u64) - 1))) { + (a.log_guest_addr & (VRING_USED_ALIGN_SIZE - 1))) { r = -EINV...
2014 Dec 25
0
[PATCH v2 2/2] vhost: relax used address alignment
...} - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + /* Make sure it's safe to cast pointers to vring types. */ + BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); + BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); + if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || + (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || + (a.log_guest_addr & (sizeof(u64) - 1))) {...
2014 Dec 25
0
[PATCH v2 2/2] vhost: relax used address alignment
...} - if ((a.avail_user_addr & (sizeof *vq->avail->ring - 1)) || - (a.used_user_addr & (sizeof *vq->used->ring - 1)) || - (a.log_guest_addr & (sizeof *vq->used->ring - 1))) { + + /* Make sure it's safe to cast pointers to vring types. */ + BUILD_BUG_ON(__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE); + BUILD_BUG_ON(__alignof__ *vq->used > VRING_USED_ALIGN_SIZE); + if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) || + (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) || + (a.log_guest_addr & (sizeof(u64) - 1))) {...
2013 Jun 06
4
[PATCH] virtio-net: put virtio net header inline with data
...ned hdr_len; + bool can_push; pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest); + if (vi->mergeable_rx_bufs) + hdr_len = sizeof hdr->mhdr; + else + hdr_len = sizeof hdr->hdr; + + can_push = vi->any_header_sg && + !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) && + !skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len; + /* Even if we can, don't push here yet as this would skew + * csum_start offset below. */ + if (can_push) + hdr = (struct skb_vnet_hdr *)(skb->data - hdr_len); + else + hdr = skb_vnet_hdr(skb);...
2013 Jun 06
4
[PATCH] virtio-net: put virtio net header inline with data
...ned hdr_len; + bool can_push; pr_debug("%s: xmit %p %pM\n", vi->dev->name, skb, dest); + if (vi->mergeable_rx_bufs) + hdr_len = sizeof hdr->mhdr; + else + hdr_len = sizeof hdr->hdr; + + can_push = vi->any_header_sg && + !((unsigned long)skb->data & (__alignof__(*hdr) - 1)) && + !skb_header_cloned(skb) && skb_headroom(skb) >= hdr_len; + /* Even if we can, don't push here yet as this would skew + * csum_start offset below. */ + if (can_push) + hdr = (struct skb_vnet_hdr *)(skb->data - hdr_len); + else + hdr = skb_vnet_hdr(skb);...
2017 Mar 01
2
[PATCH] drm: virtio: use kmem_cache
...sorq.vq); - size = count * VBUFFER_SIZE; - DRM_INFO("virtio vbuffers: %d bufs, %zdB each, %dkB total.\n", - count, VBUFFER_SIZE, size / 1024); - - vgdev->vbufs = kzalloc(size, GFP_KERNEL); + vgdev->vbufs = kmem_cache_create("virtio-gpu-vbufs", + VBUFFER_SIZE, + __alignof__(struct virtio_gpu_vbuffer), + 0, NULL); if (!vgdev->vbufs) return -ENOMEM; - - for (i = 0, ptr = vgdev->vbufs; - i < count; - i++, ptr += VBUFFER_SIZE) { - vbuf = ptr; - list_add(&vbuf->list, &vgdev->free_vbufs); - } return 0; } void virtio_gpu_fre...
2017 Mar 01
2
[PATCH] drm: virtio: use kmem_cache
...sorq.vq); - size = count * VBUFFER_SIZE; - DRM_INFO("virtio vbuffers: %d bufs, %zdB each, %dkB total.\n", - count, VBUFFER_SIZE, size / 1024); - - vgdev->vbufs = kzalloc(size, GFP_KERNEL); + vgdev->vbufs = kmem_cache_create("virtio-gpu-vbufs", + VBUFFER_SIZE, + __alignof__(struct virtio_gpu_vbuffer), + 0, NULL); if (!vgdev->vbufs) return -ENOMEM; - - for (i = 0, ptr = vgdev->vbufs; - i < count; - i++, ptr += VBUFFER_SIZE) { - vbuf = ptr; - list_add(&vbuf->list, &vgdev->free_vbufs); - } return 0; } void virtio_gpu_fre...
2015 Sep 16
0
vhost: build failure
...crosscompiling the kernel for openrisc with allmodconfig the build > failed with the error: > drivers/vhost/vhost.c: In function 'vhost_vring_ioctl': > drivers/vhost/vhost.c:818:3: error: call to '__compiletime_assert_818' declared with attribute error: BUILD_BUG_ON failed: __alignof__ > *vq->avail > VRING_AVAIL_ALIGN_SIZE > > Can you please give me any idea about what the problem might be and how > it can be solved. > > You can see the build log at: > https://travis-ci.org/sudipm-mukherjee/parport/jobs/80365425 > > regards > sudip Yes - I...