From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B205C43381 for ; Thu, 28 Feb 2019 13:36:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 178DE2171F for ; Thu, 28 Feb 2019 13:36:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="X1kjURW1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbfB1Ngh (ORCPT ); Thu, 28 Feb 2019 08:36:37 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:53944 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726003AbfB1Ngg (ORCPT ); Thu, 28 Feb 2019 08:36:36 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1SDXtok060317; Thu, 28 Feb 2019 13:36:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=C+M5Wa4qzZsT4K4xAtrE0Hw14lEmhfT9jetb24SJ8gQ=; b=X1kjURW1NUX+AzhGPAdrfiCX+ahgG4PBbnwCgOOiY5zCFFn0FvxeEynACg2DdL7cEWIe 7vQ8nPPuzWfTpgZs7HigNnFbBZoeNYfkT0zyI8Im+wb1GiCZBGBmaFsrBHvjOnEAUaQ9 /Is+2kIZvttcQmp5pbTKfUy158XWXAUzRPuNCMrp0G/mpRedVoKVowq7g9bpPmy5ZM4s k8NY6ui/3JBd06qIkrfeXz034rN7+bajRVV8Mb3jjorLHMpd55Zc9T0p1wPn56j1T1TK S4tlQhnSUmUUVsn5cpUzIob22OSCsr70Ha/cRrrZnkNcRVoruUvpobY6hRYJHXcvOvLd 2g== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2qtxts0xa4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Feb 2019 13:36:14 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1SDaDgd032329 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 28 Feb 2019 13:36:14 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x1SDaDtQ024018; Thu, 28 Feb 2019 13:36:13 GMT Received: from kadam (/197.157.0.25) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 28 Feb 2019 05:36:13 -0800 Date: Thu, 28 Feb 2019 16:36:05 +0300 From: Dan Carpenter To: Yonghong Song Cc: Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin Lau , Song Liu , "netdev@vger.kernel.org" , "kernel-janitors@vger.kernel.org" Subject: Re: [PATCH] tools/libbpf: signedness bug in btf_dedup_ref_type() Message-ID: <20190228133605.GC9806@kadam> References: <20190228054627.GC3253@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9180 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902280094 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Feb 28, 2019 at 06:58:29AM +0000, Yonghong Song wrote: > > > On 2/27/19 9:46 PM, Dan Carpenter wrote: > > The "ref_type_id" variable needs to be signed for the error handling > > to work. > > > > Fixes: d5caef5b5655 ("btf: add BTF types deduplication algorithm") > > Signed-off-by: Dan Carpenter > > --- > > This goes through the BPF tree probably, although it does apply to > > net-next. > > > > tools/lib/bpf/btf.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c > > index 68b50e9bbde1..8faed5386124 100644 > > --- a/tools/lib/bpf/btf.c > > +++ b/tools/lib/bpf/btf.c > > @@ -2326,7 +2326,8 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id) > > struct btf_type *t, *cand; > > /* if we don't find equivalent type, then we are representative type */ > > __u32 new_id = type_id; > > - __u32 h, ref_type_id; > > + __u32 h; > + int ref_type_id; > > nit. Maybe you can change to > int ref_type_id; > __u32 h; > to maintain kernel declaration reverse christmas tree convention? > Yes. Thanks. Let me resend. regards, dan carpenter