Skip to content

Commit

Permalink
Merge pull request torvalds#20 from kounoike/fix-ubsan
Browse files Browse the repository at this point in the history
fix UBSAN false positive
  • Loading branch information
tsukumijima authored Jan 12, 2025
2 parents 70d1295 + f282d1c commit d9c3f9e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion driver/ptx_chrdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion driver/ptx_chrdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d9c3f9e

Please sign in to comment.