fix UBSAN false positive

This commit is contained in:
KOUNOIKE Yuusuke
2025-01-12 17:08:46 +09:00
parent 70d12956d2
commit f282d1c100
2 changed files with 2 additions and 2 deletions

View File

@@ -807,7 +807,7 @@ int ptx_chrdev_context_add_group(struct ptx_chrdev_context *chrdev_ctx,
base, num,
PTX_CHRDEV_MINOR_IN_USE);
group = kzalloc(sizeof(*group) + (sizeof(group->chrdev[0]) * (num - 1)),
group = kzalloc(sizeof(*group) + (sizeof(group->chrdev[0]) * num),
GFP_KERNEL);
if (!group) {
ret = -ENOMEM;

View File

@@ -100,7 +100,7 @@ struct ptx_chrdev_group {
void (*owner_kref_release)(struct kref *);
unsigned int minor_base;
unsigned int chrdev_num;
struct ptx_chrdev chrdev[1];
struct ptx_chrdev chrdev[];
};
#define PTX_CHRDEV_MINOR_FREE 0