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 D048F43F09; Thu, 25 Apr 2024 20:28:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 694E24395C; Thu, 25 Apr 2024 20:27:54 +0200 (CEST) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by mails.dpdk.org (Postfix) with ESMTP id D480240A67 for ; Thu, 25 Apr 2024 20:27:50 +0200 (CEST) Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-6eced6fd98aso1329633b3a.0 for ; Thu, 25 Apr 2024 11:27:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714069670; x=1714674470; 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=OQpbZytS+kY1nG/fJPKUeiyFHYXqSezxflaAnAyheNE=; b=wJN3n+NlO729GVqA/yl4w60D0sDMkuK/MbCZXWQ46b5ILZ/X3HStPm+f3wXuKNdmJH WaC0rEewZEBt/x4QSgwzunpni3Ra9gXwTdouxUK4yglaoax4u69TIlKI4XWcPK66j7rU NK+F2KJHHdwSLYrfgHOMi0f52T7BpdeOO//5Or9QmUjU0V3sRUH+acJeLtvwpDBXFzGi aJplioCXeNfi1Ek9xl4qp2PxRgTkgEMTpfPUFT3IHuQ1SsUr6BdVLWa8RDCZ838yYgkI zkPUmAwIyzhtcjBhXSXD9D+yy+Vb5qVOoAsL2zRgN6h881xkI7knj673sD07lYUNHnqZ 3s+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714069670; x=1714674470; 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=OQpbZytS+kY1nG/fJPKUeiyFHYXqSezxflaAnAyheNE=; b=aJAY4G3q1La1qdeoD58Qd9mHQkofApuo8ZCOx3jrDssxfNe4nTXSLTzjF7RxG+7O6B cDK+FLc/Hye0U8iP2/L64q3tWf7rbgnAmZ1VjvJ3Zkss7/jSNFJQG2BKrjEyR645w1Re Y6K/gm4VFFrnR4zaTwKN54sSXtp3jUh4BLAUTJM5ZKIl15323Lvy3pXoQIRCireTP2// S2Q3q7Klkc5ub25ZEvUk06uAvz3CLRer6uCJ0kN6mcFyfAlHhs7MPdcV8E0cIKpF6ixo PCawYLEk8Uq2QClhpgl0PZ0cTw8Dkyzd7BmTVipuHrYJwJmYO6pV0LyVCHg+gr6aonj4 SY5A== X-Gm-Message-State: AOJu0Yxx3KICOceaQbmPLdD+I0PvF7KjlDHb0Z3nYT2ntkxaOT3zKlZn CWRhGMTRQ5V0zrtQN/kpDznHiOJZfjcXR2twX581efIMp9aH31gWRLp1irZ5rXqcomiQIMSbfaA p X-Google-Smtp-Source: AGHT+IHduJBmRpJurMZgunEeAYsSzK75fdFqb0wn7mzveMz/DoqH3f0nVduJ035+IjuXXBtcRN74FA== X-Received: by 2002:a05:6a00:a82:b0:6ed:1c7:8c61 with SMTP id b2-20020a056a000a8200b006ed01c78c61mr857411pfl.12.1714069670012; Thu, 25 Apr 2024 11:27:50 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d7-20020a056a00244700b006f0ba1c8ddesm4067006pfj.184.2024.04.25.11.27.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 11:27:49 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [RFC 2/4] devtools/cocci: add script to find unnecessary malloc type Date: Thu, 25 Apr 2024 11:23:59 -0700 Message-ID: <20240425182738.4771-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240425182738.4771-1-stephen@networkplumber.org> References: <20240425182738.4771-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 The malloc type argument is unused and should be NULL. This script finds and fixes those places. Signed-off-by: Stephen Hemminger --- devtools/cocci/malloc-type.cocci | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 devtools/cocci/malloc-type.cocci diff --git a/devtools/cocci/malloc-type.cocci b/devtools/cocci/malloc-type.cocci new file mode 100644 index 0000000000..d1101927e0 --- /dev/null +++ b/devtools/cocci/malloc-type.cocci @@ -0,0 +1,27 @@ +// +// The allocation name field in malloc routines was never +// implemented and should be NULL +// +@@ +expression T != NULL; +expression num, socket, size, align; +@@ +( +- rte_malloc(T, size, align) ++ rte_malloc(NULL, size, align) +| +- rte_zmalloc(T, size, align) ++ rte_zmalloc(NULL, size, align) +| +- rte_calloc(T, num, size, align) ++ rte_calloc(NULL, num, size, align) +| +- rte_malloc_socket(T, size, align, socket) ++ rte_malloc_socket(NULL, size, align, socket) +| +- rte_zmalloc_socket(T, size, align, socket) ++ rte_zmalloc_socket(NULL, size, align, socket) +| +- rte_calloc_socket(T, num, size, align, socket) ++ rte_calloc_socket(NULL, num, size, align, socket) +) -- 2.43.0