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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDACCC38A02 for ; Mon, 31 Oct 2022 13:15:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231475AbiJaNPn (ORCPT ); Mon, 31 Oct 2022 09:15:43 -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 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.