From nobody Fri Nov 22 15:46:32 2024 Received: from cmccmta2.chinamobile.com (cmccmta4.chinamobile.com [111.22.67.137]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30C4E145B39 for ; Tue, 19 Nov 2024 02:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=111.22.67.137 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731982919; cv=none; b=gqa8ss1DnYT2kpnuvPVjP3A9ZpK3a6JHQQAzVxfL8kpn005t/cFKLDvXGhde93+0hmU5cjQXTp49NGhJqZ3g26kYKiZUdeB3ff/FZEIt4ShQLUo6rkyJEYHLatkYT5QpemdM9PSUIi8pxcXt1IXtDssLkJ8u2x6CZii6JPOtPm8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731982919; c=relaxed/simple; bh=V76GVjOU2TfSlitP+o02rRpiOdtOHmZPGkHdn4JVyLE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FoWI5Ju1TH9Hm9j/N03TGodHAEkrwQOYO99PT+jI/xI21VmWyXvGDNe9ibTTsmH+OftKIRZ0Vq4f+V1A/9MaTa/932YcajLhI99AbdWk8fWeUTcyCwI5O6zllN4TZtcVSo76cgEcfs59Vad0gh/ha5nd9fJVkB8Dp+VpMor96FA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com; spf=pass smtp.mailfrom=cmss.chinamobile.com; arc=none smtp.client-ip=111.22.67.137 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=cmss.chinamobile.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from spf.mail.chinamobile.com (unknown[10.188.0.87]) by rmmx-syy-dmz-app08-12008 (RichMail) with SMTP id 2ee8673bf6412ce-81319; Tue, 19 Nov 2024 10:21:53 +0800 (CST) X-RM-TRANSID: 2ee8673bf6412ce-81319 X-RM-TagInfo: emlType=0 X-RM-SPAM-FLAG: 00000000 Received: from localhost.localdomain (unknown[223.108.79.101]) by rmsmtp-syy-appsvr05-12005 (RichMail) with SMTP id 2ee5673bf6379ee-fe980; Tue, 19 Nov 2024 10:21:53 +0800 (CST) X-RM-TRANSID: 2ee5673bf6379ee-fe980 From: guanjing To: tj@kernel.org, void@manifault.com, joshdon@google.com, haoluo@google.com, brho@google.com Cc: linux-kernel@vger.kernel.org, guanjing Subject: [PATCH v3] sched_ext: fix application of sizeof to pointer Date: Sun, 17 Nov 2024 10:51:29 +0800 Message-Id: <20241117025129.159014-1-guanjing@cmss.chinamobile.com> X-Mailer: git-send-email 2.33.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" sizeof when applied to a pointer typed expression gives the size of the pointer. The proper fix in this particular case is to code sizeof(*cpuset) instead of sizeof(cpuset). This issue was detected with the help of Coccinelle. Fixes: 22a920209ab6 ("sched_ext: Implement tickless support") Signed-off-by: guanjing Acked-by: Andrea Righi --- tools/sched_ext/scx_central.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/sched_ext/scx_central.c b/tools/sched_ext/scx_central.c index 21deea320bd7..e938156ed0a0 100644 --- a/tools/sched_ext/scx_central.c +++ b/tools/sched_ext/scx_central.c @@ -97,7 +97,7 @@ int main(int argc, char **argv) SCX_BUG_ON(!cpuset, "Failed to allocate cpuset"); CPU_ZERO(cpuset); CPU_SET(skel->rodata->central_cpu, cpuset); - SCX_BUG_ON(sched_setaffinity(0, sizeof(cpuset), cpuset), + SCX_BUG_ON(sched_setaffinity(0, sizeof(*cpuset), cpuset), "Failed to affinitize to central CPU %d (max %d)", skel->rodata->central_cpu, skel->rodata->nr_cpu_ids - 1); CPU_FREE(cpuset); --=20 2.33.0