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:
Vladislav Bolkhovitin
2010-09-10 12:54:17 +00:00
parent 4340c8f66f
commit 85aa336006

View File

@@ -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,