From patchwork Sat Oct 22 07:21:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7278 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1092101wrr; Sat, 22 Oct 2022 00:53:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6dJw25qJ9E3SYi2wG768lruuelf32QmfiTOTZk58pr4+x/MnysRL2QoY4G64tnEmId/PUS X-Received: by 2002:a05:6a00:a8c:b0:558:991a:6691 with SMTP id b12-20020a056a000a8c00b00558991a6691mr23078903pfl.53.1666425179780; Sat, 22 Oct 2022 00:52:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666425179; cv=none; d=google.com; s=arc-20160816; b=pJ+AINXO0Ct4JNKKu6rRotN/xDLpu/j4Yxy6FEHjm4lg53VraULh0BJ6N1LjFzuXiM bZJUj6Z2+ixCqxfTJE7emrU6pxjh0wrQTg2W9I4Y8HXXNbm2LdR0I1u5Yo1bTuyINTGZ ADN3xdmee8sAgsOTRsoMiImNG7vDRmwTGyxwxE0p2WZfv/vrLek0drMDXgiRisJQz1YD O8fNyBV0W9EOAa5VQ8BZYMX7pS5CVcYUUq/f2gJp7gvdmdUqPD0nUjQNf9E0dtGDTFkF i6tVenNgf1m+IbOQPpjlYmlnT7f4vdKviLl2qZxS2DUrRvF/3fIvXwPxLl4/V7FMkxil 58wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=cMp1T1quMQ+wTwiyaWoTG+HMqlXAtfFLv2DGX7RXyQ8=; b=sTBOlGr5Xj3oWfBG/vsHSQpM7i8Vw3WhqegNZDiGLrL4q/USk/Qt8jLgxZ8iYFV8WZ LWBrcdMi2MaMML4i1n7nBXKpxjgW3Qa0nis9Lr1BsbCEhIwNUDFV3800t1ZylEIxETSZ T+aljj0nMDq9oCIhYlHvVb+nLmkCR+NJij4HtxFS+Y7qeEAtR+iKNDq9n57gvq0KI3/l GWmxZYved8qF2xTr0k8Cdhwnn6VnHhTlZv/CoM9hdAaW/1imCq/QKvseGyjzN2TGkmMx U40FwdbUxsdOQQt5hWpkBLe83exLrLznKzyMWzJPqBqkC6KUTA6g7SfPVK2tIXs8M9jT 8nfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHrMRUZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170902ef4c00b001712e1efa9asi8499811plx.542.2022.10.22.00.52.46; Sat, 22 Oct 2022 00:52:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qHrMRUZi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231750AbiJVHwd (ORCPT + 99 others); Sat, 22 Oct 2022 03:52:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJVHtl (ORCPT ); Sat, 22 Oct 2022 03:49:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ACF229C4A8; Sat, 22 Oct 2022 00:46:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0500460BA1; Sat, 22 Oct 2022 07:43:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18F76C433D6; Sat, 22 Oct 2022 07:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424608; bh=nWPW16Q4nBgN2GQRonT5pZsCqcDqtb3Q2XgWjNdjRxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qHrMRUZierzEz1Xv3S+M7eDho54hpEKD0p2I2zzcJon1RmV+3gO4lFpyRs+so+/W1 eDiRvX/oXY8qKqJ6dwe9wV1iEIMENpNeRFz15jaZ0Qg4wijebPsyG9e4vPb8TMpk1S xhHF9r3ftM4JWTqazdQnO6V3qH2EJZAD0mQI+KR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lam Thai , Andrii Nakryiko , Quentin Monnet , John Fastabend , Sasha Levin Subject: [PATCH 5.19 210/717] bpftool: Fix a wrong type cast in btf_dumper_int Date: Sat, 22 Oct 2022 09:21:29 +0200 Message-Id: <20221022072452.433485524@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373449445378616?= X-GMAIL-MSGID: =?utf-8?q?1747373449445378616?= From: Lam Thai [ Upstream commit 7184aef9c0f7a81db8fd18d183ee42481d89bf35 ] When `data` points to a boolean value, casting it to `int *` is problematic and could lead to a wrong value being passed to `jsonw_bool`. Change the cast to `bool *` instead. Fixes: b12d6ec09730 ("bpf: btf: add btf print functionality") Signed-off-by: Lam Thai Signed-off-by: Andrii Nakryiko Reviewed-by: Quentin Monnet Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220824225859.9038-1-lamthai@arista.com Signed-off-by: Sasha Levin --- tools/bpf/bpftool/btf_dumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/btf_dumper.c b/tools/bpf/bpftool/btf_dumper.c index f5dddf8ef404..6d041d1f5395 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -426,7 +426,7 @@ static int btf_dumper_int(const struct btf_type *t, __u8 bit_offset, *(char *)data); break; case BTF_INT_BOOL: - jsonw_bool(jw, *(int *)data); + jsonw_bool(jw, *(bool *)data); break; default: /* shouldn't happen */