From patchwork Fri Feb 3 14:04:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1737006 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BDxU84Ed; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P7cqG5Cwtz23gY for ; Sat, 4 Feb 2023 01:04:58 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id E8930821A9; Fri, 3 Feb 2023 14:04:55 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org E8930821A9 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=BDxU84Ed X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PscW-Mdc4PxF; Fri, 3 Feb 2023 14:04:55 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 054BE82195; Fri, 3 Feb 2023 14:04:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 054BE82195 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BEEAEC007F; Fri, 3 Feb 2023 14:04:51 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9F90EC002B for ; Fri, 3 Feb 2023 14:04:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6DA2582181 for ; Fri, 3 Feb 2023 14:04:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6DA2582181 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dnmK-pfMY2Vz for ; Fri, 3 Feb 2023 14:04:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5D8D582165 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5D8D582165 for ; Fri, 3 Feb 2023 14:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675433087; x=1706969087; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=WaRnlHu7jSxKhE/JvaLSEplkobKDBaDVdAs1fxRPxZg=; b=BDxU84EdEZZm+xd0vZwszszOluxt+9wSkos6pP4rAh4/OWiQnX0QD665 /b2UmzreG/GJZhsxNV6oV7QZJBCyM7rUbfDeR0iqyFzK+ocFlukUJs3y/ +Yrfoae9H+8LNjXseIFxqiuQzEuB1G/cVfzUHj/vHLtaGsKCt+hXR3Ywc SHCNqshat5wXAdvTHKbZAdPAg3Q0gpIzopV7W0LCBhcS5HXQRRI5ccrOz ygOLLEo5yZx6YJ0YYRqfCjZuedwAR2HQX1o7FtBSeHqqyO1fqbL4huuFp UlLSkuzpJZp6p1iBxj+olt1KwRd1D2PiS5MiWWWuOq/2PBpEJiFHJLO5K g==; X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="356094849" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="356094849" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 06:04:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="729273241" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="729273241" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 03 Feb 2023 06:04:43 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id B2D0C358; Fri, 3 Feb 2023 16:05:20 +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 Date: Fri, 3 Feb 2023 16:04:59 +0200 Message-Id: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Cc: Andy Shevchenko , Jon Maloy , Eric Dumazet , Ying Xue , Paolo Abeni , "David S. Miller" Subject: [ovs-dev] [PATCH v1 1/3] string_helpers: Move string_is_valid() to the header X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Move string_is_valid() to the header for wider use. Signed-off-by: Andy Shevchenko Reviewed-by: Simon Horman --- include/linux/string_helpers.h | 5 +++++ net/tipc/netlink_compat.c | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h index 88fb8e1d0421..01c9a432865a 100644 --- a/include/linux/string_helpers.h +++ b/include/linux/string_helpers.h @@ -12,6 +12,11 @@ struct device; struct file; struct task_struct; +static inline bool string_is_valid(const char *s, int len) +{ + return memchr(s, '\0', len) ? true : false; +} + /* Descriptions of the types of units to * print in */ enum string_size_units { diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index dfea27a906f2..75186cd551a0 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c @@ -39,6 +39,7 @@ #include "node.h" #include "net.h" #include +#include #include /* The legacy API had an artificial message length limit called @@ -173,11 +174,6 @@ static struct sk_buff *tipc_get_err_tlv(char *str) return buf; } -static inline bool string_is_valid(char *s, int len) -{ - return memchr(s, '\0', len) ? true : false; -} - static int __tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, struct tipc_nl_compat_msg *msg, struct sk_buff *arg) From patchwork Fri Feb 3 14:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1737005 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=hDo02lTv; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P7cqC530mz23gY for ; Sat, 4 Feb 2023 01:04:55 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 09A7382190; Fri, 3 Feb 2023 14:04:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 09A7382190 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=hDo02lTv X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pSjgRz_FQm_c; Fri, 3 Feb 2023 14:04:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2682C82165; Fri, 3 Feb 2023 14:04:51 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2682C82165 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 043F5C0033; Fri, 3 Feb 2023 14:04:51 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8A0F1C002B for ; Fri, 3 Feb 2023 14:04:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 5075982182 for ; Fri, 3 Feb 2023 14:04:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5075982182 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SvM8iVAa4KPy for ; Fri, 3 Feb 2023 14:04:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 435F282181 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp1.osuosl.org (Postfix) with ESMTPS id 435F282181 for ; Fri, 3 Feb 2023 14:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675433088; x=1706969088; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=u+t+Nxtc784jnlWxX2i/aMwjTnnQt1oZefzR6lfuUXU=; b=hDo02lTvTxvxMcSbUwAgl2PWbFsPdBsynl0eYYyiqymEvNFPpbujALZH GhoKBZL0Yxa+ibcoUy6QgQb8EKAKdoqpHDv/L24PwqWCf12AEWj4Oetd1 nCzXpSHInWgR6k+qP4LKomhRPZ5qSAi6BPLySt03TVgUSfwez7+tbDNp8 K+9sXOrb9tNuG6180gyJbiw0EDjefPZJv2z3mjq6/XYt60g4n1E1ar0kx Vn+tr/uTlWeUHm7Wa5M+zsO0fQKhpCGxqwGGQs6m6j5T/kHYlYn161xti sn2dzK8TEHrkqwNln1xxZr1dB+wdSDu8uvIS19kvvl8YItk/k6OQf3AxV A==; X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="356094861" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="356094861" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 06:04:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="729273245" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="729273245" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 03 Feb 2023 06:04:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 55FF43B9; Fri, 3 Feb 2023 16:05:22 +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 Date: Fri, 3 Feb 2023 16:05:00 +0200 Message-Id: <20230203140501.67659-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com> References: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Cc: Andy Shevchenko , Jon Maloy , Eric Dumazet , Ying Xue , Paolo Abeni , "David S. Miller" Subject: [ovs-dev] [PATCH v1 2/3] genetlink: Use string_is_valid() helper X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- 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; } From patchwork Fri Feb 3 14:05:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1737007 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ubsm4zv1; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4P7cqK0hthz23gY for ; Sat, 4 Feb 2023 01:05:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0269842A8D; Fri, 3 Feb 2023 14:04:59 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 0269842A8D Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ubsm4zv1 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EJIMAzz5Yq4i; Fri, 3 Feb 2023 14:04:57 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 80D0642A82; Fri, 3 Feb 2023 14:04:56 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 80D0642A82 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 50438C0071; Fri, 3 Feb 2023 14:04:56 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id D2234C0071 for ; Fri, 3 Feb 2023 14:04:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id AC65B821A3 for ; Fri, 3 Feb 2023 14:04:54 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org AC65B821A3 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Ubsm4zv1 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MjnqlxruGbR6 for ; Fri, 3 Feb 2023 14:04:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 7A59B82191 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by smtp1.osuosl.org (Postfix) with ESMTPS id 7A59B82191 for ; Fri, 3 Feb 2023 14:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675433093; x=1706969093; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IEFz6QAgddcxfiR8Ghuc1c4KiIs3u68VGpMZSHRqEKw=; b=Ubsm4zv1GRZ82C4LmE/Vy2+1GtyKsmbzpIBUgdeMF6l2GOA6rf1eeOvm jYG/7wMY7P9DqCjareBV0asKvkV1ypKZvOyJvYHtRWR3tznirONGHFZmo ZIeNDjpoG3993di2+XfvLkpcbePKt/MTXb67fSM0SEmedQU3IGxLU/l2i c7FER57Y4QWukiyzh2DOSWvi7h4gCRlMTNUDrSzw0QOkGYtvXkrgcbHIa 0WFrz9BtxqDsKK85sVT8fINCWgwsZETbOg5jzBMoeAyaYirRvru9r3mdB DqKXwrjlEuXDRN22oFK4+eaTKdfXLy5vF7f4cBKp/D9tcOYaJOdq+8uo1 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="391149050" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="391149050" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 06:04:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10610"; a="808370499" X-IronPort-AV: E=Sophos;i="5.97,270,1669104000"; d="scan'208";a="808370499" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 03 Feb 2023 06:04:45 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id E1EF73CC; Fri, 3 Feb 2023 16:05:22 +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 Date: Fri, 3 Feb 2023 16:05:01 +0200 Message-Id: <20230203140501.67659-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com> References: <20230203140501.67659-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Cc: Andy Shevchenko , Jon Maloy , Eric Dumazet , Ying Xue , Paolo Abeni , "David S. Miller" Subject: [ovs-dev] [PATCH v1 3/3] openvswitch: Use string_is_valid() helper X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" 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 --- net/openvswitch/conntrack.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 2172930b1f17..1d65805e79b4 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -1383,7 +1384,7 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info, #endif case OVS_CT_ATTR_HELPER: *helper = nla_data(a); - if (!memchr(*helper, '\0', nla_len(a))) { + if (!string_is_valid(*helper, nla_len(a))) { OVS_NLERR(log, "Invalid conntrack helper"); return -EINVAL; } @@ -1404,7 +1405,7 @@ static int parse_ct(const struct nlattr *attr, struct ovs_conntrack_info *info, #ifdef CONFIG_NF_CONNTRACK_TIMEOUT case OVS_CT_ATTR_TIMEOUT: memcpy(info->timeout, nla_data(a), nla_len(a)); - if (!memchr(info->timeout, '\0', nla_len(a))) { + if (!string_is_valid(info->timeout, nla_len(a))) { OVS_NLERR(log, "Invalid conntrack timeout"); return -EINVAL; }