diff mbox series

[ovs-dev,v1,2/3] genetlink: Use string_is_valid() helper

Message ID 20230203140501.67659-2-andriy.shevchenko@linux.intel.com
State Handled Elsewhere
Headers show
Series [ovs-dev,v1,1/3] string_helpers: Move string_is_valid() to the header | expand

Checks

Context Check Description
ovsrobot/intel-ovs-compilation fail test: fail

Commit Message

Andy Shevchenko Feb. 3, 2023, 2:05 p.m. UTC
Use string_is_valid() helper instead of cpecific memchr() call.
This shows better the intention of the call.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 net/netlink/genetlink.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Simon Horman Feb. 4, 2023, 1:25 p.m. UTC | #1
On Fri, Feb 03, 2023 at 04:05:00PM +0200, Andy Shevchenko wrote:
> Use string_is_valid() helper instead of cpecific memchr() call.
> This shows better the intention of the call.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

For networking patches, the target tree, in this case net-next, should
appear in the patch subject:

[PATCH v1 net-next 1/3] genetlink: Use string_is_valid() helper

That notwithstanding,

Reviewed-by: Simon Horman <simon.horman@corigine.com>
diff mbox series

Patch

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 600993c80050..d7616c1bda93 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -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>
@@ -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_valid(grp->name, GENL_NAMSIZ)))
 			return -EINVAL;
 	}