Skip to content

Commit

Permalink
genetlink: Use string_is_terminated() helper
Browse files Browse the repository at this point in the history
Use string_is_terminated() helper instead of cpecific memchr() call.
This shows better the intention of the call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230208133153.22528-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Andy Shevchenko authored and Jakub Kicinski committed Feb 10, 2023
1 parent f1db99c commit d4545bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/string.h>
#include <linux/string_helpers.h>
#include <linux/skbuff.h>
#include <linux/mutex.h>
#include <linux/bitmap.h>
Expand Down Expand Up @@ -457,7 +457,7 @@ static int genl_validate_assign_mc_groups(struct genl_family *family)

if (WARN_ON(grp->name[0] == '\0'))
return -EINVAL;
if (WARN_ON(memchr(grp->name, '\0', GENL_NAMSIZ) == NULL))
if (WARN_ON(!string_is_terminated(grp->name, GENL_NAMSIZ)))
return -EINVAL;
}

Expand Down

0 comments on commit d4545bf

Please sign in to comment.