Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2525504lqp; Mon, 25 Mar 2024 01:08:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXdVZKJDM4L8JsoLuxtws9mEFiP2NQTYzW1aOrLCQtNtIXdOOI9Xz4VTrkQMY9h2fCNJ7W0I4t+OjjaGy6NE4XaYaoWS/x9rsGT6quhOA== X-Google-Smtp-Source: AGHT+IEjftSPsy0N+dP/OnrhJuDEacFO9v2WBrKv/dC2Q6qpwBtgllAivbXTdIvSszdeiz5X50fM X-Received: by 2002:a05:6102:2831:b0:476:334:4992 with SMTP id ba17-20020a056102283100b0047603344992mr4628070vsb.15.1711354085223; Mon, 25 Mar 2024 01:08:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711354085; cv=pass; d=google.com; s=arc-20160816; b=ua87bW6SEzXfVjAChzjs9lXF3t3NmcQUc+rxl8+EI2RyAZ+rUn0NVox5WHeIuO1qqe IVxB0tYPEmh3XQqCNlFi7iWeqShTTNSWpiAP6xj+VcRkYzel6jn1e4RIt2Krs7moYzVG uNw28OlZQP2tKJlqBK5Dq5d9kru8D0Nbk91XKMZs+L6iRwQeyU4MtK9OqX7xGUi5QKa5 Gz1DNmLsLFYnJKgQ8ipfXn8mlbSyi93qlkcJOR35qp8KdD+PKt239jXZgBjpeer2r9z9 jTMshfjumH3bT2+SybsyVRqNi9CrBQWcEl4oSTbpl7dNLG2dxRhqAyHx8UrET4fb7Xjd o4tw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=V3f7KAd7ymOsuDYcCKwo76n7sNVesZ1/VVbVqDLopK0=; fh=oOSkryNVGdOoZG7G8UzIdJAa3fZmIG0J2/n/xwQiVoc=; b=ZNbZK8gQmatZWoFJurmVfqc0nntNi6RN/DzTK8PBdK0ccaY4mwefpSyv5hlW5U6k02 vmU/xFv5fP09w84aYoQDvoP5L72J8rtMmu+O038o4GnVbCvwvHQ53cx3sMcZpoDcUe4H vi46Haw0XwYSjTlYexV5Ia1xweJzBL8XTxUWUpjZ6TKpqfcdJFusD/yqPF54lA1z3ha2 foC6jdJaSfQebeVdeR1DN1SUVgjW8Hj9txlJJlQDjQf2gMxOE2bCmLYIF9X9R35HY7gC LgSAoAKgsQrQZB2c3FG7lO8WTdFyNcPFpiRwmM1ApvJ8g1k06yAwxqpfIueAnlhDSwbV zuMg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdSMPKz1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115852-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115852-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vu13-20020a05620a560d00b00789f574e5dcsi4833218qkn.638.2024.03.25.01.08.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 01:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115852-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PdSMPKz1; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115852-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115852-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EE2C01C2D7D9 for ; Mon, 25 Mar 2024 08:08:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1403C37D658; Mon, 25 Mar 2024 03:02:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PdSMPKz1" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8779B535AC; Sun, 24 Mar 2024 23:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322029; cv=none; b=jz4cd3Y5/vLhcncTH53s28COI3A9wZCGyjhzi+JLsVdnv0qUHytwx4ZoJhfN2rnXJHh9nLMVzostb8yHceKzq8nHxgahF6QsFu75kvQd1bhS301JbxzWG1W9kjSAK1a2RFAR6ldCYrcPDjW+OmG+oyAEe4lL3TAG7frSJC6a9ro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322029; c=relaxed/simple; bh=uq/8y/d2mm1LK4gZZU9rrLc3HRKyMlwRIrSKlVi9Lr4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KuPl6o0PEiyo1HRZDbm1IW2iOEnYEDz0zJZ1G8WtXH9RYTUv/Hzp8qWgj8bGWav10RKk1gGObFbC10Hz168B+LCStGHf0P31psl/nzzLArbcgHqAvMCjh7gftjWg8N38MoR/HerOK7ktH8d7EzBm4SnP1AJh5PNiATgLfdWso3Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PdSMPKz1; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9815CC43390; Sun, 24 Mar 2024 23:13:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322028; bh=uq/8y/d2mm1LK4gZZU9rrLc3HRKyMlwRIrSKlVi9Lr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PdSMPKz17jVKo+SF1cWfpUxFS+NbvAXyEulrUmLpS+nubpbQ7oPWws6a/UgRFEcak kZHPU5z4MO/WlQbd5cDjylRis4dFFUKaNQ6VUNPiTViEn+y36baVrcLc+s26DiLd7i lu+8696blUtPk8tfK5y2kQ4rL3lWaoogevRk54ZyTwk7ruCwT/e9zraRlbE4uX6XNl ciGfT94KCzqBdLuYLXgooDLgNHpHITeB1cjZKKM76M57o7GpkajVLysejps+/wpc6U eLj7w9kgEQri64guxJZ483USA2zId2iFn1SU4Fa4ZFxw0FCQQBYyob6qQSXzuLBrOU I5JhggFbDqVXg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tiezhu Yang , Daniel Borkmann , Quentin Monnet , Alexei Starovoitov , Sasha Levin Subject: [PATCH 6.1 100/451] bpftool: Silence build warning about calloc() Date: Sun, 24 Mar 2024 19:06:16 -0400 Message-ID: <20240324231207.1351418-101-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Tiezhu Yang [ Upstream commit f5f30386c78105cba520e443a6a9ee945ec1d066 ] There exists the following warning when building bpftool: CC prog.o prog.c: In function ‘profile_open_perf_events’: prog.c:2301:24: warning: ‘calloc’ sizes specified with ‘sizeof’ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 2301 | sizeof(int), obj->rodata->num_cpu * obj->rodata->num_metric); | ^~~ prog.c:2301:24: note: earlier argument should specify number of elements, later size of each element Tested with the latest upstream GCC which contains a new warning option -Wcalloc-transposed-args. The first argument to calloc is documented to be number of elements in array, while the second argument is size of each element, just switch the first and second arguments of calloc() to silence the build warning, compile tested only. Fixes: 47c09d6a9f67 ("bpftool: Introduce "prog profile" command") Signed-off-by: Tiezhu Yang Signed-off-by: Daniel Borkmann Reviewed-by: Quentin Monnet Link: https://lore.kernel.org/bpf/20240116061920.31172-1-yangtiezhu@loongson.cn Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- tools/bpf/bpftool/prog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c index 41c02b6f6f043..7e0b846e17eef 100644 --- a/tools/bpf/bpftool/prog.c +++ b/tools/bpf/bpftool/prog.c @@ -2200,7 +2200,7 @@ static int profile_open_perf_events(struct profiler_bpf *obj) int map_fd; profile_perf_events = calloc( - sizeof(int), obj->rodata->num_cpu * obj->rodata->num_metric); + obj->rodata->num_cpu * obj->rodata->num_metric, sizeof(int)); if (!profile_perf_events) { p_err("failed to allocate memory for perf_event array: %s", strerror(errno)); -- 2.43.0