提交 aefc5818 编写于 作者: M Ma Shimiao 提交者: Santosh Shilimkar

soc: ti: fix max dup length for kstrndup

If source string longer than max, kstrndup will alloc max+1 space.
So, we should make sure the result will not over limit.
Signed-off-by: NMa Shimiao <mashimiao.fnst@cn.fujitsu.com>
Signed-off-by: NSantosh Shilimkar <santosh.shilimkar@oracle.com>
上级 bd0fa74e
...@@ -225,7 +225,7 @@ static struct knav_queue *__knav_queue_open(struct knav_queue_inst *inst, ...@@ -225,7 +225,7 @@ static struct knav_queue *__knav_queue_open(struct knav_queue_inst *inst,
if (!knav_queue_is_busy(inst)) { if (!knav_queue_is_busy(inst)) {
struct knav_range_info *range = inst->range; struct knav_range_info *range = inst->range;
inst->name = kstrndup(name, KNAV_NAME_SIZE, GFP_KERNEL); inst->name = kstrndup(name, KNAV_NAME_SIZE - 1, GFP_KERNEL);
if (range->ops && range->ops->open_queue) if (range->ops && range->ops->open_queue)
ret = range->ops->open_queue(range, inst, flags); ret = range->ops->open_queue(range, inst, flags);
...@@ -779,7 +779,7 @@ void *knav_pool_create(const char *name, ...@@ -779,7 +779,7 @@ void *knav_pool_create(const char *name,
goto err; goto err;
} }
pool->name = kstrndup(name, KNAV_NAME_SIZE, GFP_KERNEL); pool->name = kstrndup(name, KNAV_NAME_SIZE - 1, GFP_KERNEL);
pool->kdev = kdev; pool->kdev = kdev;
pool->dev = kdev->dev; pool->dev = kdev->dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册