[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aOUQMZQr3JwNTUYX@stanley.mountain>
Date: Tue, 7 Oct 2025 16:05:53 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Murad Sadigov <sdgvmrd@...il.com>
Cc: Greg KH <gregkh@...uxfoundation.org>, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: axis-fifo: fix integer overflow in write()
Hi Murad,
This can't happen because vfs_write() caps len at <= MAX_RW_COUNT.
Presumably this is your Linkedin page?
https://www.linkedin.com/in/mrdsdgv/?originalSubdomain=az
When you're doing the analysis on this sort of thing, it's nice to
have the Smatch cross function db built. I hacked up the vfs_write()
information a bit so it says that len can't be more than 1G when
actually it's capped at 2G. I did that so that count + len wouldn't
trigger an integer overflow warning. Those are prevented in
rw_verify_area().
$ smdb axis_fifo_write
file | caller | function | type | parameter | key | value |
fs/read_write.c | vfs_write | (struct file_operations)->write | INTERNAL | -1 | | long(*)(struct file*, char*, ulong, llong*)
fs/read_write.c | vfs_write | (struct file_operations)->write | BIT_INFO | 0 | f->f_mode | 0x40002,0xffffffff
fs/read_write.c | vfs_write | (struct file_operations)->write | USER_DATA | 1 | buf | 0-u64max[c]
fs/read_write.c | vfs_write | (struct file_operations)->write | USER_DATA | 2 | len | 0-1000000000
fs/read_write.c | vfs_write | (struct file_operations)->write | USER_DATA | 3 | *off | 0-1000000000
fs/read_write.c | vfs_write | (struct file_operations)->write | USER_PTR | 3 | off |
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 0 | f | 4096-9223372036854775807
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 0 | f->f_op | 4096-ptr_max
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 0 | f->f_op->write | 1-u64max
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 2 | len | 0-1000000000,2147479552
fs/read_write.c | vfs_write | (struct file_operations)->write | FUZZY_MAX | 2 | len | 2147479552
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 3 | *off | 0-1000000000
fs/read_write.c | vfs_write | (struct file_operations)->write | PARAM_VALUE | 3 | off | 0,4096-ptr_max
fs/read_write.c | vfs_write | (struct file_operations)->write | CONTAINER | 0 | -32-80+0 | $(-1)
fs/read_write.c | vfs_write | (struct file_operations)->write | DATA_SOURCE | 0 | f | $0
fs/read_write.c | vfs_write | (struct file_operations)->write | DATA_SOURCE | 1 | buf | $1
fs/read_write.c | vfs_write | (struct file_operations)->write | DATA_SOURCE | 2 | len | $2 [m]
fs/read_write.c | vfs_write | (struct file_operations)->write | DATA_SOURCE | 3 | off | $3
fs/read_write.c | vfs_write | (struct file_operations)->write | 2059 | -1 | | y
fs/read_write.c | vfs_write | (struct file_operations)->write | 2059 | -1 | | y
fs/read_write.c | vfs_write | (struct file_operations)->write | BUF_SIZE | 3 | off | (-1),8
$
regards,
dan carpenter
Powered by blists - more mailing lists