From patchwork Mon Oct 24 11:28:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 9077 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp445415wru; Mon, 24 Oct 2022 06:12:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Um+Px6LshXWAlUNQkr1T4k7EsgUHbKz+TmKzfpeJql8/J6P1bMquRc89suQfzU0o29zDs X-Received: by 2002:a17:902:d4c6:b0:186:850a:4f09 with SMTP id o6-20020a170902d4c600b00186850a4f09mr14714013plg.77.1666617153984; Mon, 24 Oct 2022 06:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666617153; cv=none; d=google.com; s=arc-20160816; b=KW3J9wV82V1V2ljUC8cO8IOzHB62TCI4TBxEfyRjYIPT4x5+Qpa6sU4sNcXz3W8t65 BTtSHSIuznPpwfl+zpVObjSh5Gp5pEZ9Y0G/8kWrISotYLa16115ImNGeyexWCHdJ8Ht GvtCGN0REDbZoDlrXrLWy9JAcH+5dwcQUOfO2RkltsSK73njZCaTBG6vVaUByPzpQ+nJ A+4qeGhlEaHiMwTitTbsNTC2C1uBlHDemxioTBCrqBrU1iRBu9TLSYSEgcfDZ9MRF2jy 3Qkc8QpLxBHxuTfPWTptwz5wSo1ID27EPrEn40uyvuUhNlmwczkY23zbU0wb+wCHMW+o 8Q3A== 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=E69hr2fUkCzNDsf5b15x0y6Hz+LBLNVjdeD6fkW/pDU=; b=0gvJruhjJDSEO1KtrpQgwLUUpjixoNWRbsN8wG6mBaCeNQa17ArGUB8bdPFYNDMr0x xDPvjO+eNaHDJKTBZLlY9N7iWIwZHc/XvrU0Xpi8y03b9GdzIaB92tDBNxWTZvwB09D5 MaIG7ZdaOH+ZABZzpefaXDBdlC7OiljPoxodXEvCKyPvYV3guKL4mAdz0HOhPHmirL9s UT6ogCZqyTj3sxqsxoOVEu3h6nyGqI4MupMgu2baQp5xXQxcbzDeVVFxY0anwf9AtZ8k 68Qc4VEE7wWK5G8K5e7B2brS791CyegQ7gnzcUnPpVoiqeJJ1HjUBdm+boxLpNI6lhzy dTAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="DGNg8/nO"; 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 y13-20020a17090a474d00b0020a880cf1cbsi8637924pjg.134.2022.10.24.06.12.20; Mon, 24 Oct 2022 06:12:33 -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="DGNg8/nO"; 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 S235648AbiJXNL6 (ORCPT + 99 others); Mon, 24 Oct 2022 09:11:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235800AbiJXNJk (ORCPT ); Mon, 24 Oct 2022 09:09:40 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20241A030F; Mon, 24 Oct 2022 05:23:08 -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 sin.source.kernel.org (Postfix) with ESMTPS id 14C9ECE1323; Mon, 24 Oct 2022 12:20:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07669C433C1; Mon, 24 Oct 2022 12:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666614024; bh=MDq74IDoaSx8NT65BkbK9O4FQ2r6jWC7helViqns7qE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGNg8/nO8KpojkhvCZYzbc/zOfDKT/LV2foTfWPpsW0qXnqCa4ubUGnQQTVaIcC+f jIpEo2qku5Ej/p4RrvU1vYLa/mjzGCmAkrSiwlvxJh3mFx+WueIrZ7Dxmk90aK34t2 0jR73aYfPrI2jBv1iGLOF6n6zBZLVGCYAPVbhKbs= 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.10 103/390] bpftool: Fix a wrong type cast in btf_dumper_int Date: Mon, 24 Oct 2022 13:28:20 +0200 Message-Id: <20221024113027.058117575@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221024113022.510008560@linuxfoundation.org> References: <20221024113022.510008560@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?1747574748510320267?= X-GMAIL-MSGID: =?utf-8?q?1747574748510320267?= 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 0e9310727281..13be48763199 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -416,7 +416,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 */