search for: struct_siz

Displaying 20 results from an estimated 54 matches for "struct_siz".

Did you mean: struct_size
2019 May 24
1
[PATCH] drm/nouveau/mmu: use struct_size() helper
Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes, in particular in the context in which this code is being used. So, replace the following form: sizeof(*kind) + sizeof(*kind->data) * mmu->kind_nr; with: struct_size(kind, data, mmu->kind_nr) This...
2019 Jun 19
3
[PATCH] scsi: virtio_scsi: Use struct_size() helper
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct virtio_scsi { ... struct virtio_scsi_vq req_vqs[]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following form: sizeof(*vscsi) + sizeof(vscsi->req_vqs[0]) * num_queues with: struct_size(vscsi, req_vqs, num_queues) This code was detected with the help of Coccinelle. Signed-off-by:...
2019 Jun 19
3
[PATCH] scsi: virtio_scsi: Use struct_size() helper
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct virtio_scsi { ... struct virtio_scsi_vq req_vqs[]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following form: sizeof(*vscsi) + sizeof(vscsi->req_vqs[0]) * num_queues with: struct_size(vscsi, req_vqs, num_queues) This code was detected with the help of Coccinelle. Signed-off-by:...
2019 Aug 07
0
[PATCH] drm/nouveau/nvif/mmu: Use struct_size() helper
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct nvif_mmu_kind_v0 { ... __u8 data[]; }; Make use of the struct_size() helper instead of an open-coded version in order to avoid any potential type mistakes. So, replace the following form: sizeof(*kind) + sizeof(*kind->data) * mmu->kind_nr with: struct_size(kind, data, mmu->kind_nr) This code was detected with the help of Coccinelle. Signed-off-by:...
2020 Aug 17
0
[PATCH][next] drm/virtio: Use struct_size() helper in kmalloc()
On Wed, Jun 17, 2020 at 04:57:07PM -0500, Gustavo A. R. Silva wrote: > Make use of the struct_size() helper instead of an open-coded version > in order to avoid any potential type mistakes. > > This code was detected with the help of Coccinelle and, audited and > fixed manually. > > Signed-off-by: Gustavo A. R. Silva <gustavoars at kernel.org> Queued up for drm-misc-n...
2019 Jul 12
0
[PATCH] scsi: virtio_scsi: Use struct_size() helper
Gustavo, > One of the more common cases of allocation size calculations is finding > the size of a structure that has a zero-sized array at the end, along > with memory for some number of elements for that array. For example: Applied to 5.4/scsi-queue, thanks! -- Martin K. Petersen Oracle Linux Engineering
2010 Mar 27
3
Dovecot 2.0beta4 HG 11014: Crashes on parsing settings via LMTP service
...gt; /var/log/dovecot.log <== Mar 27 08:13:38 spectre dovecot: lmtp(8362): Connect from local Mar 27 08:13:38 spectre dovecot: lmtp(8362): Panic: file settings-parser.c: line 1501 (settings_link_get_new): assertion failed: (diff + sizeof(*old_link->array) <= old_link->parent->info->struct_size) Mar 27 08:13:38 spectre dovecot: lmtp(8362): Raw backtrace: /usr/lib/dovecot/libdovecot.so.0 [0x7f055dec6712] -> /usr/lib/dovecot/libdovecot.so.0 [0x7f055dec677a] -> /usr/lib/dovecot/libdovecot.so.0(i_error+0) [0x7f055dec6b23] -> /usr/lib/dovecot/libdovecot.so.0 [0x7f055dea6993] -> /u...
2023 Mar 29
1
[PATCH] drm/nouveau/svm: remove unused ret variable
..., u64 *pfns, unsigned long npages) { struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); - int ret; args->p.addr = addr; args->p.size = npages << PAGE_SHIFT; mutex_lock(&svmm->mutex); - ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, - struct_size(args, p.phys, npages), NULL); + nvif_object_ioctl(&svmm->vmm->vmm.object, args, + struct_size(args, p.phys, npages), NULL); mutex_unlock(&svmm->mutex); } -- 2.27.0
2023 Nov 16
3
[PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by
...ng: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=] drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1072:29: warning: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=] While there, also make use of the struct_size() helper, and address checkpatch.pl warning: WARNING: please, no spaces at the start of a line This results in no differences in binary output. Signed-off-by: Gustavo A. R. Silva <gustavoars at kernel.org> --- .../nvrm/535.113.01/nvidia/generated/g_os_nvoc.h | 14 +++++++------- drivers...
2024 Jan 10
2
[PATCH 2/6] drm/nouveau/svm: remove unused but set variables
..., u64 *pfns, unsigned long npages) { struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); - int ret; args->p.addr = addr; args->p.size = npages << PAGE_SHIFT; mutex_lock(&svmm->mutex); - ret = nvif_object_ioctl(&svmm->vmm->vmm.object, args, - struct_size(args, p.phys, npages), NULL); + nvif_object_ioctl(&svmm->vmm->vmm.object, args, + struct_size(args, p.phys, npages), NULL); mutex_unlock(&svmm->mutex); } -- 2.39.2
2023 Sep 25
1
[PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
...pendency_table(struct pp_hwmgr *hwmgr, struct smu10_voltage_dependency_table **pptable, uint32_t num_entry, const DpmClock_t *pclk_dependency_table) { uint32_t i; struct smu10_voltage_dependency_table *ptable; ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL); if (NULL == ptable) return -ENOMEM; ptable->count = num_entry; So the implication is that it's native byte order... but you tell me! I certainly don't want this annotation if it's going to break stuff. :) -...
2023 Sep 25
1
[PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
...pendency_table(struct pp_hwmgr *hwmgr, struct smu10_voltage_dependency_table **pptable, uint32_t num_entry, const DpmClock_t *pclk_dependency_table) { uint32_t i; struct smu10_voltage_dependency_table *ptable; ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL); if (NULL == ptable) return -ENOMEM; ptable->count = num_entry; So the implication is that it's native byte order... but you tell me! I certainly don't want this annotation if it's going to break stuff. :) -...
2023 Sep 25
1
[PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by
...pendency_table(struct pp_hwmgr *hwmgr, struct smu10_voltage_dependency_table **pptable, uint32_t num_entry, const DpmClock_t *pclk_dependency_table) { uint32_t i; struct smu10_voltage_dependency_table *ptable; ptable = kzalloc(struct_size(ptable, entries, num_entry), GFP_KERNEL); if (NULL == ptable) return -ENOMEM; ptable->count = num_entry; So the implication is that it's native byte order... but you tell me! I certainly don't want this annotation if it's going to break stuff. :) -...
2012 Sep 04
1
Repeated Asterisk 10.7.0 crashes
...from /lib64/libc.so.6 (gdb) up #2 0x0000003686e6971b in __libc_message () from /lib64/libc.so.6 (gdb) up #3 0x0000003686e71e7e in _int_malloc () from /lib64/libc.so.6 (gdb) up #4 0x0000003686e7382d in calloc () from /lib64/libc.so.6 (gdb) up #5 0x000000000054a2a0 in _ast_calloc (num_structs=1, struct_size=88, field_mgr_offset=64, field_mgr_pool_offset=16, pool_size=128, file=0x101010101010101 <Address 0x101010101010101 out of bounds>, lineno=1235, func=0x58af9e "ast_log") at /usr/src/asterisk-10.7.1/include/asterisk/utils.h:495 495 AST_INLINE_API( Once this s...
2023 Nov 16
1
[PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by
...ript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=] > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1072:29: warning: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=] > > While there, also make use of the struct_size() helper, and address > checkpatch.pl warning: > WARNING: please, no spaces at the start of a line > > This results in no differences in binary output. > > Signed-off-by: Gustavo A. R. Silva <gustavoars at kernel.org> > --- > .../nvrm/535.113.01/nvidia/generated/g_...
2020 Feb 07
0
[RFC PATCH v7 54/78] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
..._cmd_vcpu_get_info(struct kvm_vcpu *vcpu, return 0; } + +static void * +alloc_get_registers_reply(const struct kvmi_msg_hdr *msg, + const struct kvmi_vcpu_get_registers *req, + size_t *rpl_size) +{ + struct kvmi_vcpu_get_registers_reply *rpl; + u16 k, n = req->nmsrs; + + *rpl_size = struct_size(rpl, msrs.entries, n); + rpl = kvmi_msg_alloc_check(*rpl_size); + if (rpl) { + rpl->msrs.nmsrs = n; + + for (k = 0; k < n; k++) + rpl->msrs.entries[k].index = req->msrs_idx[k]; + } + + return rpl; +} + +static int kvmi_get_registers(struct kvm_vcpu *vcpu, u32 *mode, + struc...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...*virtio_init_pci(PCIBus *bus, const char *name, + uint16_t vendor, uint16_t device, + uint16_t subvendor, uint16_t subdevice, + uint8_t class_code, uint8_t subclass_code, + uint8_t pif, size_t config_size, + size_t struct_size) +{ + VirtIODevice *vdev; + PCIDevice *pci_dev; + uint8_t *config; + + pci_dev = pci_register_device(bus, name, struct_size, + -1, NULL, NULL); + vdev = to_virtio_device(pci_dev); + + vdev->status = 0; + vdev->isr = 0; + vdev->queue_sel = 0; + m...
2007 Dec 21
0
[Virtio-for-kvm] [PATCH 1/7] userspace virtio
...*virtio_init_pci(PCIBus *bus, const char *name, + uint16_t vendor, uint16_t device, + uint16_t subvendor, uint16_t subdevice, + uint8_t class_code, uint8_t subclass_code, + uint8_t pif, size_t config_size, + size_t struct_size) +{ + VirtIODevice *vdev; + PCIDevice *pci_dev; + uint8_t *config; + + pci_dev = pci_register_device(bus, name, struct_size, + -1, NULL, NULL); + vdev = to_virtio_device(pci_dev); + + vdev->status = 0; + vdev->isr = 0; + vdev->queue_sel = 0; + m...
2020 Jul 21
0
[PATCH v9 56/84] KVM: introspection: add KVMI_VCPU_GET_REGISTERS
...i.c @@ -98,3 +98,96 @@ int kvmi_arch_cmd_vcpu_get_info(struct kvm_vcpu *vcpu, return 0; } + +int kvmi_arch_check_get_registers_req(const struct kvmi_msg_hdr *msg, + const struct kvmi_vcpu_get_registers *req) +{ + size_t req_size; + + if (check_add_overflow(sizeof(struct kvmi_vcpu_hdr), + struct_size(req, msrs_idx, req->nmsrs), + &req_size)) + return -1; + + if (msg->size < req_size) + return -1; + + return 0; +} + +static int kvmi_get_registers(struct kvm_vcpu *vcpu, u32 *mode, + struct kvm_regs *regs, + struct kvm_sregs *sregs, + struct kvm_msrs *msr...
2024 Jan 29
0
[PATCH] [v2] nouveau: add command-line GSP-RM registry support
...ated by add_registry() is released. + */ +static void build_registry(struct nvkm_gsp *gsp, PACKED_REGISTRY_TABLE *registry) +{ + struct registry_list_entry *reg, *n; + size_t str_offset; + unsigned int i = 0; + + registry->numEntries = list_count_nodes(&gsp->registry_list); + str_offset = struct_size(registry, entries, registry->numEntries); + + list_for_each_entry_safe(reg, n, &gsp->registry_list, list) { + registry->entries[i].type = reg->type; + registry->entries[i].data = reg->data; + registry->entries[i].length = reg->length; + registry->entries[i].nameO...