From patchwork Wed Oct 19 08:25:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 5574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp351267wrs; Wed, 19 Oct 2022 07:15:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Tz7ko5wjm1FEg1U/m8PY/iqH+ZTXaE7iMuQ/iPtMTwtjJlRVdDrBOZAuyLtvd8fP21I6b X-Received: by 2002:a17:907:6e8b:b0:793:30e1:96c9 with SMTP id sh11-20020a1709076e8b00b0079330e196c9mr1879384ejc.97.1666188901002; Wed, 19 Oct 2022 07:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188900; cv=none; d=google.com; s=arc-20160816; b=Qa1ZVzYrHupTf0s/3NrG+s+D9X0I2QV/yId4tr9llR3g+nqwR5cwkw9uZguMpHm9EB +Ais3n5aCERIb+Fxiw94UUhYx4bhQQSjjhh0q4yRtzMQk+kWZkV0uWRdWVXexCbABh86 hGwpj1tMjVYUeMeCx/D9uP6JPbuiY/uKTjlUCN8stDl8LZ29aOOycO/r8oksBt1RQpYi fq8dma93GVAKfbKJ4fIq/WbvmHH8cmHuPfDwQBbWkXSoaMn1v6EPkK9NRrbNoaPWd9rW EisnNnJJulVCa3QuzyM26p++nccYIgry7O1L5DIcKe7ELE0D6GroEsa91J6HJeVlPxLZ QHNg== 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=tgRNBsAGVSbqbAzQnO7L+2sMBFK3o1vvG/l5PH+R4Uk=; b=yIjLfhobnHKBzl1gxf3OzKIrfBvBdzOjInbzYm8xajE5ClG9L5pDDRwhpeVNV0cLRI l4XA1l0JY2CIj5ERBfEy3FDyvAeGNEpKy0eoNVmVbbIC435L66LxhWE9q8MZM0NVfIQM IdDCLyYdjOOW8qr1Uxm9XD2o9mgCLxGtoQ8JZ3Q0sA6s1xThjSfF+yr0vRziGKZ76Gob J1bcEWmyk6S0QQmTTRTTn0Xe11Q9idYmm5O/5TT1GFg0uYUU4ANZ2SB7KKtu9rJigfiq fuigusOE2yrw/4/ytJxQuUyxGMpt0Qo2jTOVLczeJ9NxA6yQiT1a8/UQOeH7WSqO93S1 /gwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DoukKzLs; 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 o19-20020aa7dd53000000b00447dfae6181si12282404edw.235.2022.10.19.07.14.27; Wed, 19 Oct 2022 07:15:00 -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=DoukKzLs; 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 S233835AbiJSN5p (ORCPT + 99 others); Wed, 19 Oct 2022 09:57:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233975AbiJSNyf (ORCPT ); Wed, 19 Oct 2022 09:54:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39BA518542D; Wed, 19 Oct 2022 06:37: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 D0FBFB8232A; Wed, 19 Oct 2022 08:49:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C976C433D6; Wed, 19 Oct 2022 08:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169349; bh=boiTHlnuO/TKiwsbBxT4uNEIkYKD57pTRY5XdiRnf60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DoukKzLs+mW3AKNP1Guu6XARVf26XA5saEjmy/P98BpSBs0Aca4T1oLHkiVPLRbSI bn2YhYxZZl4Tbr02tEFDimjTC+FZcEElzOsKrCR71ftza1rZUzO+MQO+1zsPDLoGu8 WpIlrA4fFwao2CNexndqpEQtOj5vRN9nHkbqoevg= 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 6.0 244/862] bpftool: Fix a wrong type cast in btf_dumper_int Date: Wed, 19 Oct 2022 10:25:31 +0200 Message-Id: <20221019083300.795945784@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 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?1747125693265142016?= X-GMAIL-MSGID: =?utf-8?q?1747125693265142016?= 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 125798b0bc5d..19924b6ce796 100644 --- a/tools/bpf/bpftool/btf_dumper.c +++ b/tools/bpf/bpftool/btf_dumper.c @@ -452,7 +452,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 */