From patchwork Mon Oct 24 11:29:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 8897 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp433866wru; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6H1FSOZg//ayrpN0PYHcNA1S6raEKnNth4gZTCwU1WC5swY314Ie68IuHFVvEGW++a34AR X-Received: by 2002:a05:6402:190f:b0:461:bd53:27c4 with SMTP id e15-20020a056402190f00b00461bd5327c4mr5405195edz.75.1666615843470; Mon, 24 Oct 2022 05:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666615843; cv=none; d=google.com; s=arc-20160816; b=lw+2y/rhYyp+zcHACNe1t0SemaB3z/eY9vqeVRx2iwsZ/wyZ71BIiaQ81xbbVAlkhz Ksn+u+ksBHnHrWLcBYRCgO6y+c+ecqedIuFrl4qBuoXw1D1Vlm6BEO5TffGeKCjeL5Y3 fkkzG0aLqL72B5T00Gw7tJ43xRSEDL2QnNOxm/QK2zz11R63xowsMwOLNfh05+z4Gy/j j/1bl4V/hK2pM3O5qNgS9dK3u1QmjcdhBEb4hRAcoLsvUT7wrpk4l+Rdy71FhdR0HvY+ +iWyFsA4lZtmHVpEuU9yTGgJEUVpbPYkDAhGVViwKWcGM9qgwznSw8xYReaJWUnfWCi5 HUfQ== 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=eCMu2uidSaa5fyIIHrq/0Av7b/6mZEMPhUwKvWpgsbw=; b=sL5w5gxC8xE4fi+rm60/ztx8gn7DsCQ59eaWz4X1N8CXxkKLM9P4MZKXPlwfKegX2i 1svu+n7p2ICQ+3WjZWGra0ncOzm1yDrZ2ewGS9IwevxFh5wO9NomesZ7vTcZDDjqdj4J Z5orLCgaghZxpLwvaS0D3U+XnCxD7urpqF/f7zIFpMjbQb1EatyfGi7I+kRBlwLqiK9d 1R362HCZ8CsqUhQWQN8C33Mu+hJchNZVFbZiBK76B01eZfI01FFwPFFMolv840SIBbYl 8qr/Zq4vKiQUiwsdrMGEfu4iprBS0z4i0hHQXAEM2/gVu83t86QT663BKFxhfQeYZiuP egug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=whPg1C6H; 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 j11-20020a05640211cb00b0045f802c0b98si17599037edw.443.2022.10.24.05.50.17; Mon, 24 Oct 2022 05:50:43 -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=whPg1C6H; 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 S234155AbiJXMsj (ORCPT + 99 others); Mon, 24 Oct 2022 08:48:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234338AbiJXMoX (ORCPT ); Mon, 24 Oct 2022 08:44:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4412721B1; Mon, 24 Oct 2022 05:09:12 -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 AF1D0612D2; Mon, 24 Oct 2022 12:07:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3B2CC433C1; Mon, 24 Oct 2022 12:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666613248; bh=9vtvKDeSqBdPU8YAR9Q9YNhvZJPLYD1863BGmsYTrgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whPg1C6HsWyn3yATueTs6JdLFIW7k1B+V65ptzgagM69v0TqKwKiEBZqd9pENSPVY rLHepw/fF3tYcnpV8+KXWTflzXpo9xZgDy2dS1ZNFbozzx3tZ+WvpnfOE+EmYDgqL6 qP/Lj5PefWAZPj284VorMComT4gPAocUr5SA/J1E= 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.4 065/255] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:29:35 +0200 Message-Id: <20221024113004.698380237@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113002.471093005@linuxfoundation.org> References: <20221024113002.471093005@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?1747573374776671739?= X-GMAIL-MSGID: =?utf-8?q?1747573374776671739?= 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 397e5716ab6d..ebb73e447310 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -251,7 +251,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 */