Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1148761rwi; Wed, 19 Oct 2022 07:16:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oS73vmPQPX2Z2Bm7wqbnaluzd5Sm/cfXot6kSmxFBQlamRCI1z33m3yi6ik0UGdS9CG4Y X-Received: by 2002:a17:907:2c6b:b0:78d:e4ae:6073 with SMTP id ib11-20020a1709072c6b00b0078de4ae6073mr6878070ejc.612.1666188970124; Wed, 19 Oct 2022 07:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666188970; cv=none; d=google.com; s=arc-20160816; b=eAjpsrApuwtEnWgQkLLDR78oL5TUWEiGDvLY/CxjdpufwlPD7TtDFHqBXkDuAnHcfQ JRk9gLJAQrRoYtOASuQLHtrntZ8n3xmjG1OreR6jxJyldeetXeEhP6e24nBcZnM97aW8 kuVgtBmP7i+a58ESSvM3/P99DHSDk0ORaWqjsiOgQ8JdXsx7qr6Zwhb3D4y+2VKhoY9b B8PAvq4mmTIa3xjXL/4Be5fVPYLy/yXF5pCnqsESYT2Hv7CxbJNrseshXhHk6vwMDWeg cJR+abvV4fphoNmFgW5NNk5RvINUZiLpO40FNEule/8LIYOj/3QSQ6yHMdf3L8cCK56C swgw== 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 Return-Path: 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.15.44; Wed, 19 Oct 2022 07:16:10 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 */ -- 2.35.1