From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C914343BAD; Fri, 1 Mar 2024 00:00:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B295442DBD; Fri, 1 Mar 2024 00:00:00 +0100 (CET) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mails.dpdk.org (Postfix) with ESMTP id 2E00E42DBD for ; Thu, 29 Feb 2024 23:59:59 +0100 (CET) Received: by mail-pj1-f42.google.com with SMTP id 98e67ed59e1d1-29b18c81ee4so618249a91.3 for ; Thu, 29 Feb 2024 14:59:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709247598; x=1709852398; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g6uhYXuFO0hkzj3eBHFdCdGhcudl4GtPWett1S7Oeck=; b=Iu9NsTWLtub71hkSeZda0NABfHKEmon738fsSvbAIP/OLZ5a+t5saxEm3U0vLNhTkt dhIWRAsL0pfZXXO7iK5mJ4FUixLUth/cHa8RseWv4MsBwyVODzuE3ZC74AkJtg8S9cTj 7zL2ilY3BqyFuPcTHSPVSo3L5IOZn3rCOITmqURc+WXt8hHetprtoYwOwkhEqg811r63 ORU6BqvsZdJ9RFtrjL9k0CFbLk+SFbFA5EnxFB+B6Cm4VU4T1jScfrlv8Xfh77Cb6kyf 1YS36b510Bh3P0AyDvV72EyyFbttQp2WtiP7XKituT4tCSZZu9JksVd/wTZ/disPCp88 AV5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247598; x=1709852398; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g6uhYXuFO0hkzj3eBHFdCdGhcudl4GtPWett1S7Oeck=; b=ZES+u9iViXQr7xRTNzRlSUoV7SVEGMJWUN1mGgNfUqR6j1qLMvI98DcavnpwGpdXw6 9ikk3yyIfA+J95QsVR5CR+cj2EoVM/XSaQbX0iFhuzP4XADkCqkIahMDnI4s2nplLk25 LrWw7TvUrG0tEPcMkNNFmBoMkjPEJ6+jfx3cPXCVGBw+TyQSB9vJWSuV3GTN8KLggTXe TLzcEDKe3ubPvzKbxmkzzDZ5hmHBLxVHrYhNYUGtlIaLOtJ3RcreVWyMqx4P26cMDV1M Fx7qJ1XRCvXTezvNldnYZIwVghSD+oV4t//yLkcXTJN03Ox+0gVypJf8PCNhumh6/c2T qv3w== X-Gm-Message-State: AOJu0Yyt56T0RpQ0z6sNI48VQXSYsbZYzq+fsi5Kn9OVUKvKVjU7kAbG o/HiaHWVm16mwoggZSymd6lCFHAHOILRznOYmGwfJr+ST+GHbtEM2k/vj2b8vtXHKeLfsrdX+CX s X-Google-Smtp-Source: AGHT+IEjJpjvkrvCK3qCjVxrx+/axmhuGlAWYJGHVj1Jq38lbJ7f++WD3nqwjEiTLiB8z5GbfWbFig== X-Received: by 2002:a17:90b:3603:b0:299:1f80:8c44 with SMTP id ml3-20020a17090b360300b002991f808c44mr14382pjb.40.1709247598379; Thu, 29 Feb 2024 14:59:58 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id l22-20020a17090b079600b0029a8e5355fcsm1965578pjz.53.2024.02.29.14.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 14:59:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH 01/71] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Date: Thu, 29 Feb 2024 14:57:48 -0800 Message-ID: <20240229225936.483472-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229225936.483472-1-stephen@networkplumber.org> References: <20240229225936.483472-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Rte_memcpy should not be used for the simple case of copying a fix size structure because it is slower and will hide problems from code analysis tools. Coverity, fortify and other analyzers special case memcpy(). Gcc (and Clang) are smart enough to inline copies which will be faster. Signed-off-by: Stephen Hemminger --- devtools/cocci/rte_memcpy.cocci | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 devtools/cocci/rte_memcpy.cocci diff --git a/devtools/cocci/rte_memcpy.cocci b/devtools/cocci/rte_memcpy.cocci new file mode 100644 index 000000000000..fa1038fc066d --- /dev/null +++ b/devtools/cocci/rte_memcpy.cocci @@ -0,0 +1,11 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst; constant size; +@@ +( +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +) -- 2.43.0