Commit 852b6ed110990891d21bf76b4f46a3c854866f67
1 parent
35d1efe805
Exists in
master
and in
20 other branches
target/iblock: Use match_strlcpy for Opt_udev_path string assignment
Following commit dbc6e0222 from Al Viro for fileio, go ahead and make Opt_udev_path within iblock_set_configfs_dev_params use match_strlcpy instead of the match_strdup -> snprintf -> kfree equivalent. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 1 changed file with 3 additions and 6 deletions Side-by-side Diff
drivers/target/target_core_iblock.c
... | ... | @@ -454,14 +454,11 @@ |
454 | 454 | ret = -EEXIST; |
455 | 455 | goto out; |
456 | 456 | } |
457 | - arg_p = match_strdup(&args[0]); | |
458 | - if (!arg_p) { | |
459 | - ret = -ENOMEM; | |
457 | + if (match_strlcpy(ib_dev->ibd_udev_path, &args[0], | |
458 | + SE_UDEV_PATH_LEN) == 0) { | |
459 | + ret = -EINVAL; | |
460 | 460 | break; |
461 | 461 | } |
462 | - snprintf(ib_dev->ibd_udev_path, SE_UDEV_PATH_LEN, | |
463 | - "%s", arg_p); | |
464 | - kfree(arg_p); | |
465 | 462 | pr_debug("IBLOCK: Referencing UDEV path: %s\n", |
466 | 463 | ib_dev->ibd_udev_path); |
467 | 464 | ib_dev->ibd_flags |= IBDF_HAS_UDEV_PATH; |