Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp684856rwi; Mon, 31 Oct 2022 06:27:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iTiAw43s1VP0STFUhZcj1Nacu3ru0/G2WKauWCgj/UzpFdRTtQI9Zs2ggQtEhxv4rXAWz X-Received: by 2002:a17:90b:33cb:b0:212:f276:62ce with SMTP id lk11-20020a17090b33cb00b00212f27662cemr15264628pjb.149.1667222874517; Mon, 31 Oct 2022 06:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667222874; cv=none; d=google.com; s=arc-20160816; b=ruj3zUeWOFbMVrObY/Y26a+WZymGL95rpH0PYcFnCDcobtGnes8SWo9jCRsthVVAGs Ke4rPnq98w26/r3LchkYdrHD+UAZtJyzQ2AvSO19300xUgRKEwh95x8EM9Vq2g/RLmyS JVBhWP8ZzVNEO1c0aL8BVBIyWH2mb0G0brXgKwcABlNSCFZAH39LPiqJmFqfSeYGijq6 97vjU9eNB8PclvQovs5cyokl+k+E1qoB4F0fGMjcIV9n3zT228jf43wqNd15zMw7q3Q0 0Bu6m3mhJArWSmKW4SU9GNg/CGGWcoL+gvMjpQjrb0BO18byAlo7mkS880B7V7DZ7FmG UNog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IGoilmK91RhEEXcDDjLoScAYGtZO0SjZXqnGMsah/9M=; b=ZH1mOMywnjpTiP4j2nNbEEk1O/ufFrwVMnvT0MVBbFJeqp13gnT6YaAgneXTorKP6l RbrWaGnsoCeMzTwDI7/uamLC3OSsxfApCYBXy6YI2ex1oXzlW4Xs464NkpBRWI0hqc4E VN65d4I5bSCkyCIt7YAx4yTdZhCoG/aBcEjLbWEIogt+a0WCRJ7AdywwqTuJ/0cABmnw 6SMJ2hLwi/PmT+H4vK5qWtrmWqTGgKVl0HYJSyDCjWOF9wx0eTTd5CEIvIChxSTFuBek BDemzrhbJXAPfu9wZzch0eQKvS8QzZyNAo7qEPop6cZ1LUnTgqwon1sLlH04SPAg+Sm8 Whmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=zUdWXkWx; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x19-20020a170902ea9300b00186940d7eaasi8390273plb.31.2022.10.31.06.27.41; Mon, 31 Oct 2022 06:27:54 -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=@infradead.org header.s=bombadil.20210309 header.b=zUdWXkWx; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231468AbiJaNPm (ORCPT + 98 others); Mon, 31 Oct 2022 09:15:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231461AbiJaNPk (ORCPT ); Mon, 31 Oct 2022 09:15:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14CAA60C7; Mon, 31 Oct 2022 06:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IGoilmK91RhEEXcDDjLoScAYGtZO0SjZXqnGMsah/9M=; b=zUdWXkWxOcDFwpH6bgp0SA2FUf YL4M43p8pqwPiDjvRyV1bUGB7VDbGMyN+/cH7XpzfVcN7/o8wVebyBH7aXJxoJ40OkGcsUtmgaeFY V3/k4e8Scg13R1v3OLg3FQTu7cLwImXeaT+jayzw4C94tcl1ZHN8hpp2ySXsUGMnE+KZdOX4ZN/CM BtK7IxJcKvYENab6OMfZ4qWV2l5uAfFV4jFVbXHyH3CDLQNWI//bOWjOSIamGxTaJEOok4Hch5fYF sdvS9OO/SNms/w4Ap5gRPTJCqVT4N8arECslXeEgCMeYN+OU9/qfrM6kFRoR5pTMDRtTY2C8UqN0U GiVpdJuw==; Received: from hch by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1opUdY-00BwK5-Vr; Mon, 31 Oct 2022 13:15:32 +0000 Date: Mon, 31 Oct 2022 06:15:32 -0700 From: Christoph Hellwig To: Gaosheng Cui Cc: viro@zeniv.linux.org.uk, dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] fs: fix undefined behavior in bit shift for SB_NOUSER Message-ID: References: <20221029071745.2836665-1-cuigaosheng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221029071745.2836665-1-cuigaosheng1@huawei.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 On Sat, Oct 29, 2022 at 03:17:45PM +0800, Gaosheng Cui wrote: > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -1396,7 +1396,7 @@ extern int send_sigurg(struct fown_struct *fown); > #define SB_NOSEC (1<<28) > #define SB_BORN (1<<29) > #define SB_ACTIVE (1<<30) > -#define SB_NOUSER (1<<31) > +#define SB_NOUSER (1U<<31) Let's mark all of the flags as unsigned instead of just one so that we don't mix types. s_flags is already unsigned (although for some reason long) already. And while you touch this please add the proper whitespaces around the shift operator everywhere.