Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6819439rwi; Mon, 24 Oct 2022 06:32:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rpSOQFZ+XdJf1YGdurJVOIL1Jwpbb/QgWmU8x5b6DGSwnTUUTIBEVjZyS5+RQ7cVDRGMW X-Received: by 2002:a17:902:e811:b0:186:8a61:ea76 with SMTP id u17-20020a170902e81100b001868a61ea76mr12128922plg.10.1666618373927; Mon, 24 Oct 2022 06:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666618373; cv=none; d=google.com; s=arc-20160816; b=KRKTDQ7imlDDr5FnCmyPoA2jXGy4F1CrzYG18FJLsUcBqy9bbW1atRzjuuH2CH3/1z t5aJV7kUwooIwhV6hdldC7JF/KAk2xE1i7OPAKcGfWn7hJVYbN7P/Yffjy/2/xn0X92i cc/KQEM4G46Mt5x3LEz7M+AWvtmVbk3Ftd0TizWKgQ/tE6kQEKCTfe3p3leYIxV/uITD V3EAwR3YMoBrIN0sYpANAkMgSJH2TjamqJ2t227AiaAZp2SxynvMaFO4BLveyJQIruIf J40SCZQyL+rOhgZH4XaCduyBQVlDId0KIzpivy+QvCnN3ffzH/iTtNarKgkGTtyTDzvF W3vg== 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=ybSxrX7hcAt3drMvU0n+pdIUNlht54SS59SFNWC2epU=; b=iH0gUY7jbsVaLXymVeOWNYMdxzBpoSaOx5wAxQgHzRZfgllFEEKo1WsGHx+36Cmamh EGfpy6gVDp73v1wmsoRhhlDUPApNZdob8DnvIfKNHBcwY4vb1iP4tfC1uieXzTpmcHAf KCg/J6DiegyP2+U1pzfZ/hbP3E4cYcHmsNgZRGgVM0HjOnVqPtXJPvrLKj1C2+spR6eo FQ4xpo62dwKo/+dVdmnRnQ/aFmNgVwcNDergbWoXZTJpz7bgMCdi+hwioRoa3e6cRY/L HbhZGFFhElZExinrCaJjJyH+Pr3YVuYFkrOOnzvH/A3fq5mpfTNTK4st3XDc8Yn9ydzg u+aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SDHwTNwC; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e10-20020a170902f10a00b00182a9c27a9csi12536615plb.603.2022.10.24.06.32.40; Mon, 24 Oct 2022 06:32:53 -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=SDHwTNwC; 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 S233926AbiJXM3C (ORCPT + 99 others); Mon, 24 Oct 2022 08:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233793AbiJXM2P (ORCPT ); Mon, 24 Oct 2022 08:28:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 696CB86F91; Mon, 24 Oct 2022 05:02:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 13944B811A1; Mon, 24 Oct 2022 11:57:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF22C433D6; Mon, 24 Oct 2022 11:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666612666; bh=5jtB3YGE+UAWdXBMYTNVATKere32q+gsH1tPZl6hWoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SDHwTNwCSY0/Ws6vMTU5gUXHHlWzeHW/LLXx6op88He78KLdQa3dMKWBLJj8xBdgb lWuowtxMxjl+viFuFSPRA/1qwjQoCckouMj8aqhTJok4JjqvKL748SiaVziYv2U+rs o39YoL+S2Few9VlKvsvbBJk132E+FStbfqV9aQW0= 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 4.19 073/229] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:29:52 +0200 Message-Id: <20221024113001.440029793@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024112959.085534368@linuxfoundation.org> References: <20221024112959.085534368@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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 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 1e7c619228a2..2da43d930ed3 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -164,7 +164,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 */ -- 2.35.1