Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4090C636D3 for ; Mon, 6 Feb 2023 16:14:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231787AbjBFQOS (ORCPT ); Mon, 6 Feb 2023 11:14:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231747AbjBFQNw (ORCPT ); Mon, 6 Feb 2023 11:13:52 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1891121A34; Mon, 6 Feb 2023 08:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675700011; x=1707236011; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=opG93wOQRIEErRHxhGk0I3FgKRpuFZyL/E0+9hZucw0=; b=Jc7QLODUsDsFgeyXlfByDiFntbY/QpvZRHhuWDyWvN5qSCBbcksammns RCZIXjgrCcU5/xOoL1soZDfJ+ZUGYgMtvKo9HYHykjR5YWjNRxZXl8jDc DOJTLeMLqL37uPAAJgmRReIlXqYYaYBGHIB3wHRNsbs9cmlhgw/5BWpcq ebCBMfdEAFACrg8r/ni1VLMfEFKfXqBqC1PXc74QMP53HBpIhZ4axW4ze 0nnGrrQS10BZMnVErFEGPPPiDQqx6S1s2yemPUuVWvl7FyPKyfNpT5aPD qBUhhNEE07oU5FfvNAXw8tKrZr7+IPgTOyKCClRHErBe8lWHbBaqxh3hI Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="308888767" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="308888767" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 08:12:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="698884369" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="698884369" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 06 Feb 2023 08:12:37 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E75381DD; Mon, 6 Feb 2023 18:13:15 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , Jakub Kicinski , Xin Long , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, dev@openvswitch.org, tipc-discussion@lists.sourceforge.net Cc: Andy Shevchenko , "David S. Miller" , Eric Dumazet , Paolo Abeni , Pravin B Shelar , Jon Maloy , Ying Xue , Simon Horman Subject: [PATCH net-next v2 2/3] genetlink: Use string_is_valid() helper Date: Mon, 6 Feb 2023 18:13:13 +0200 Message-Id: <20230206161314.15667-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230206161314.15667-1-andriy.shevchenko@linux.intel.com> References: <20230206161314.15667-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use string_is_valid() helper instead of cpecific memchr() call. This shows better the intention of the call. Signed-off-by: Andy Shevchenko Reviewed-by: Simon Horman --- v2: added tag and updated subject (Simon) 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 #include #include -#include +#include #include #include #include @@ -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