]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ubi: Reserve sufficient buffer length for the input mask
authorZhaoLong Wang <wangzhaolong1@huawei.com>
Tue, 26 Dec 2023 01:01:12 +0000 (09:01 +0800)
committerRichard Weinberger <richard@nod.at>
Sat, 6 Jan 2024 22:45:44 +0000 (23:45 +0100)
Because the mask received by the emulate_failures interface
is a 32-bit unsigned integer, ensure that there is sufficient
buffer length to receive and display this value.

Signed-off-by: ZhaoLong Wang <wangzhaolong1@huawei.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/debug.c

index 007f82d71020ebdcb216295699f74de7abbb41bd..d57f52bd2ff3cd7a20b293b3993874a4826cffb2 100644 (file)
@@ -332,7 +332,7 @@ static ssize_t dfs_file_read(struct file *file, char __user *user_buf,
        struct dentry *dent = file->f_path.dentry;
        struct ubi_device *ubi;
        struct ubi_debug_info *d;
-       char buf[8];
+       char buf[16];
        int val;
 
        ubi = ubi_get_device(ubi_num);
@@ -400,7 +400,7 @@ static ssize_t dfs_file_write(struct file *file, const char __user *user_buf,
        struct ubi_device *ubi;
        struct ubi_debug_info *d;
        size_t buf_size;
-       char buf[8] = {0};
+       char buf[16] = {0};
        int val;
 
        ubi = ubi_get_device(ubi_num);