From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jakub Kicinski <kuba@kernel.org>, Xin Long <lucien.xin@gmail.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
dev@openvswitch.org, tipc-discussion@lists.sourceforge.net
Cc: Andy Shevchenko <andy@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Pravin B Shelar <pshelar@ovn.org>, Jon Maloy <jmaloy@redhat.com>,
Ying Xue <ying.xue@windriver.com>
Subject: [PATCH v1 2/3] genetlink: Use string_is_valid() helper
Date: Fri, 3 Feb 2023 16:05:00 +0200 [thread overview]
Message-ID: <20230203140501.67659-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com>
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(-)
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;
}
--
2.39.1
next prev parent reply other threads:[~2023-02-03 14:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 14:04 [PATCH v1 1/3] string_helpers: Move string_is_valid() to the header Andy Shevchenko
2023-02-03 14:05 ` Andy Shevchenko [this message]
2023-02-04 13:25 ` [ovs-dev] [PATCH v1 2/3] genetlink: Use string_is_valid() helper Simon Horman
2023-02-03 14:05 ` [PATCH v1 3/3] openvswitch: " Andy Shevchenko
2023-02-04 13:26 ` [ovs-dev] " Simon Horman
2023-02-04 13:25 ` [ovs-dev] [PATCH v1 1/3] string_helpers: Move string_is_valid() to the header Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230203140501.67659-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=edumazet@google.com \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pshelar@ovn.org \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.