io_class string ctr: use strnlen
Signed-off-by: Michal Rakowski <michal.rakowski@intel.com>
This commit is contained in:
parent
d6cd388d3e
commit
1b46117908
@ -198,17 +198,12 @@ static int _cas_cls_string_ctr(struct cas_classifier *cls,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
len = strlen(data);
|
||||
len = strnlen(data, MAX_STRING_SPECIFIER_LEN);
|
||||
if (len == 0) {
|
||||
CAS_CLS_MSG(KERN_ERR, "String specifier is empty\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (len > MAX_STRING_SPECIFIER_LEN) {
|
||||
CAS_CLS_MSG(KERN_ERR, "String specifier to long: %s\n", data);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
|
||||
if (!ctx)
|
||||
return -ENOMEM;
|
||||
|
Loading…
Reference in New Issue
Block a user