Merge pull request #20 from kounoike/fix-ubsan

fix UBSAN false positive
This commit is contained in:
tsukumi
2025-01-12 21:43:31 +09:00
committed by GitHub
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, base, num,
PTX_CHRDEV_MINOR_IN_USE); 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); GFP_KERNEL);
if (!group) { if (!group) {
ret = -ENOMEM; ret = -ENOMEM;

View File

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