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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = strlen(data);
|
len = strnlen(data, MAX_STRING_SPECIFIER_LEN);
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
CAS_CLS_MSG(KERN_ERR, "String specifier is empty\n");
|
CAS_CLS_MSG(KERN_ERR, "String specifier is empty\n");
|
||||||
return -EINVAL;
|
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);
|
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
|
||||||
if (!ctx)
|
if (!ctx)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
Loading…
Reference in New Issue
Block a user