diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-19 22:26:18 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:14 -0400 |
commit | 4b33a1916a351ba3bf5af42fb38a988a5dce11bf (patch) | |
tree | b6972b83d758ed3dd07102bc883376df337c3244 /fs/bcachefs/chardev.c | |
parent | 75e0c4789b623db0abae497160202bc5f5d2522e (diff) | |
download | linux-stable-4b33a1916a351ba3bf5af42fb38a988a5dce11bf.tar.gz linux-stable-4b33a1916a351ba3bf5af42fb38a988a5dce11bf.tar.bz2 linux-stable-4b33a1916a351ba3bf5af42fb38a988a5dce11bf.zip |
bcachefs: bch2_ioctl_disk_resize_journal(): check for integer truncation
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/chardev.c')
-rw-r--r-- | fs/bcachefs/chardev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index 51d671267741..e8b6733e7f71 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -627,6 +627,9 @@ static long bch2_ioctl_disk_resize_journal(struct bch_fs *c, arg.pad) return -EINVAL; + if (arg.nbuckets > U32_MAX) + return -EINVAL; + ca = bch2_device_lookup(c, arg.dev, arg.flags); if (IS_ERR(ca)) return PTR_ERR(ca); |