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=-3.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, 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 9C35FC43387 for ; Tue, 15 Jan 2019 21:35:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 674A72086D for ; Tue, 15 Jan 2019 21:35:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="bXM5mw+Y" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390536AbfAOVfU (ORCPT ); Tue, 15 Jan 2019 16:35:20 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:49384 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390501AbfAOVfU (ORCPT ); Tue, 15 Jan 2019 16:35:20 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id x0FLYCuU037782; Tue, 15 Jan 2019 21:35:13 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=JCDizEUGQn7Rw/h3GrGFuRXwaFtbOfMhJxb4aqlWrmM=; b=bXM5mw+YyaLR2qfX8S/IafPAXJovyvX1tBFnNYMer3xRr/v7dYWK61KiScJdss21Ucbh e7Atk9bVX57m7nIT4PvSYLnHjLbzh5odHW3TMojgnS6rGch4qHrxYdc0PBCY5zetw39K HqqFi1IN64ee9yqSqNeUeDp03j2OihVrODJaYcp5QUgfikzAQj+tnajMPHzJ4WfRK+HL jslvNNGH4uSnnWOEqDpFXPBWHSRUrL4iZesd+sUVcwgbfUjtzRYGrdcgL4zMs5iYCKgU uScU1JtgEJoStHU3f3rnIco2+rT3BqG2pLHiuI8pkifLLOPm1EWzMMBWyedmrFrRiCfR 3w== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2pybjs6e5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jan 2019 21:35:13 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x0FLZC7v003156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Jan 2019 21:35:12 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x0FLZB91004816; Tue, 15 Jan 2019 21:35:11 GMT Received: from kadam (/197.157.34.180) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 Jan 2019 13:35:11 -0800 Date: Wed, 16 Jan 2019 00:35:00 +0300 From: Dan Carpenter To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] XArray: Fix a math problem in xa_is_err() Message-ID: <20190115213500.GJ4504@kadam> References: <20190115195241.GB1074@kadam> <20190115210726.GC6310@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190115210726.GC6310@bombadil.infradead.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9137 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901150171 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, Jan 15, 2019 at 01:07:26PM -0800, Matthew Wilcox wrote: > On Tue, Jan 15, 2019 at 10:52:41PM +0300, Dan Carpenter wrote: > > @@ -177,7 +177,8 @@ static inline bool xa_is_internal(const void *entry) > > static inline bool xa_is_err(const void *entry) > > { > > return unlikely(xa_is_internal(entry) && > > - (unsigned long)entry >= -((MAX_ERRNO << 2) + 2)); > > + (unsigned long)entry >= > > + (((unsigned long)(-MAX_ERRNO << 2) + 2))); > > } > > Ugh all the brackets, I'm not surprised I got it wrong. How about this > instead; does it make your static checker happy? > I wasn't a super fan of that expression either... I think your code will work, and if not then it's the checker which needs fixing. Thanks! regards, dan carpenter