mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-14 09:11:27 +00:00
Fixes sparse failure on constructs like "char str[max(...)];", because it does not recognize expressions like
max(constant1, constant2) as a constant. Also, sizeof(string) + 1 reserves one byte too much: sizeof(string) does count the terminating zero byte. Signed-off-by: Bart Van Assche <bvanassche@acm.org> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2088 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -2772,7 +2772,7 @@ static void dev_user_setup_functions(struct scst_user_dev *dev)
|
||||
|
||||
static int dev_user_check_version(const struct scst_user_dev_desc *dev_desc)
|
||||
{
|
||||
char str[max_t(int, sizeof(DEV_USER_VERSION)+1, 20)];
|
||||
char str[sizeof(DEV_USER_VERSION) > 20 ? sizeof(DEV_USER_VERSION) : 20];
|
||||
int res = 0, rc;
|
||||
|
||||
rc = copy_from_user(str,
|
||||
|
||||
Reference in New Issue
Block a user