Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp1557722iol; Fri, 10 Jun 2022 09:50:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf3b5hffquK2X/f1WhU8pfoqpKHxyj1edrKODlkpS8JlJ9svNAa7iJcrXsDW4TO4uA2I8D X-Received: by 2002:a17:902:d4d0:b0:163:d4dc:bff8 with SMTP id o16-20020a170902d4d000b00163d4dcbff8mr47445388plg.129.1654879841865; Fri, 10 Jun 2022 09:50:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654879841; cv=none; d=google.com; s=arc-20160816; b=QbRkSH/4xia7YJtZ9oeMkG2UaSDjeuawTpk6Oga8TvxaVEzmUzO7CkaHmWaRG4Zn8s HsM8MW1mRLLea0I5jpjQ7cyZUAIGn7rz6mBunUiweUMYTKt4F7gx9SL8DYeNCuNzcfE3 EcJtzKD3SunX7zwHNed1CwSKqO6pq9j4BA5+EJ7/xxDDGFT4f/8m8QIJhU+EeK26DY4V mUYzir+ZLIT30bbp7E+AYQYEhtRkFmXwJvcUhDZZlzJSXthEIaTKtAXXNZSBIPRz3TC/ Pg6mHL1pXBw4+9VgOCJHgBSrcr0ObY1bkN1/pWfGUzlWUi5JjjyvlxrnWr4z/JA2qNtv km7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=ioFgM6y+XdcF78saLPERgD1M4sbpP2D6QZPHFDZ9vvM=; b=tGLn6WQON3ulWOs5uCbYkCieGz/c0WeWk6UWaGM5M51H6nKQ2853ciIy0ZhJXP4a0g ccPaAddMGUJOzmdQAvDFvnsLEiwaYd7YBwdjcF2ag4xnoTgs9xUmEwqBNZ7UtL2pWTtz bEREzUVcpHERrDi/7GO95Pf2xNFLrB0wBZps8+YFmR69Igr6iUhIKGItOVZZ2jsMXO1k YG8/R78TT+u5Pfk4xOsNKWBGAbVr6i7B9yn94kfTocQ0HgUrM6Q6NkB1jhgVvSMaVNSa iABjykn9Gn2IYkC8dF2RSl/khrUN262kceCgBineibBIW5XeVRycU+z/9cSgDHNVuVLi 4EfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paragon-software.com header.s=mail header.b=Jvmkrgx1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 184-20020a6301c1000000b003fdb58c86b4si21166064pgb.675.2022.06.10.09.50.30; Fri, 10 Jun 2022 09:50:41 -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=@paragon-software.com header.s=mail header.b=Jvmkrgx1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=paragon-software.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349541AbiFJQVj (ORCPT + 99 others); Fri, 10 Jun 2022 12:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbiFJQVe (ORCPT ); Fri, 10 Jun 2022 12:21:34 -0400 Received: from relayaws-01.paragon-software.com (relayaws-01.paragon-software.com [35.157.23.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDB9B3A3903; Fri, 10 Jun 2022 09:21:31 -0700 (PDT) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 911C91D99; Fri, 10 Jun 2022 16:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1654878049; bh=ioFgM6y+XdcF78saLPERgD1M4sbpP2D6QZPHFDZ9vvM=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=Jvmkrgx162jlNF4axBM0VM7hdMFogDadVe78W2/U6nIUULF1a9PVKdVlVLRfieBO+ MrGGkX1zIh/bk8yx4gXZqT2uR0SLgJBZJLkDo2DoHMc09sB4k769MJZwWDNZOOYTH3 CCi7I0BhjvNaL11AOtTwvTxmU/3bfF5FTnik8wRM= Received: from [172.30.8.65] (172.30.8.65) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 10 Jun 2022 19:21:29 +0300 Message-ID: <01e2f814-1fcf-bc0c-b580-e3879eda85b6@paragon-software.com> Date: Fri, 10 Jun 2022 19:21:28 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH] fs/ntfs3: Don't clear upper bits accidentally in log_replay() Content-Language: en-US To: Dan Carpenter CC: , , , References: From: Konstantin Komarov In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [172.30.8.65] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 5/9/22 12:03, Dan Carpenter wrote: > The "vcn" variable is a 64 bit. The "log->clst_per_page" variable is a > u32. This means that the mask accidentally clears out the high 32 bits > when it was only supposed to clear some low bits. Fix this by adding a > cast to u64. > > Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") > Signed-off-by: Dan Carpenter > --- > Why am I getting new Smatch warnings in old ntfs3 code? It is a mystery. > > fs/ntfs3/fslog.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c > index 915f42cf07bc..0da339fda2f4 100644 > --- a/fs/ntfs3/fslog.c > +++ b/fs/ntfs3/fslog.c > @@ -5057,7 +5057,7 @@ int log_replay(struct ntfs_inode *ni, bool *initialized) > goto add_allocated_vcns; > > vcn = le64_to_cpu(lrh->target_vcn); > - vcn &= ~(log->clst_per_page - 1); > + vcn &= ~(u64)(log->clst_per_page - 1); > > add_allocated_vcns: > for (i = 0, vcn = le64_to_cpu(lrh->target_vcn), Thanks for patch, applied!