From patchwork Mon Oct 24 11:29:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp430394wru; Mon, 24 Oct 2022 05:41:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5utlO49FbBw/kLlhULifZzH6AVO7zspoNO3YP1QSFzVjCGntYHEKvE97m9NwzI+9TpMKlD X-Received: by 2002:a17:902:e952:b0:17c:7aaa:c679 with SMTP id b18-20020a170902e95200b0017c7aaac679mr33498749pll.74.1666615275396; Mon, 24 Oct 2022 05:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615275; cv=none; d=google.com; s=arc-20160816; b=t8PJQIjdYZ+ak4h7VuSDsrgywHpaNExstHvorYvkTYYP1A2B0lZh524HBgmNbyXWyW trKCh/FTCZXPik+NTWJ1H6k3DHM8abOQ+LjmDUzUZ5SM37QS6mM2p1c2mHmclwKjuXgH WGxQCFuafHeEakAlSe6WpWOcaHKCGdQFIW/SpXj85KlMoNCQH2moXnuMwzgWgf5RrDLg oNz5s6sTEi5ndX8fNVUWHsAA51z2AAYYxlmnAuK6XtAjTeri52g1K/zcvfGhkQE4K6Ny 9OW0TOEF0Lee+K1dfJ+jzMIC01CKOKX9TBAQj6F0q75m9j1T2mpaHFQFNpgqHuRrLvUm BLiA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a187-20020a6390c4000000b0046b172c5c54si33592792pge.561.2022.10.24.05.41.01; Mon, 24 Oct 2022 05:41:15 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747572779081133057?= X-GMAIL-MSGID: =?utf-8?q?1747572779081133057?= 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 */