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 635EDCCA47E for ; Tue, 7 Jun 2022 15:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344639AbiFGP7K (ORCPT ); Tue, 7 Jun 2022 11:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344674AbiFGP67 (ORCPT ); Tue, 7 Jun 2022 11:58:59 -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 C74ED5DE4E for ; Tue, 7 Jun 2022 08:58:56 -0700 (PDT) Received: from relayfre-01.paragon-software.com (unknown [172.30.72.12]) by relayaws-01.paragon-software.com (Postfix) with ESMTPS id 5FA5B255B; Tue, 7 Jun 2022 15:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1654617497; bh=gyeTbiR+uUhE29A+RGuh6i8rdvYUlUvUGCn1xr1k4cs=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=E9D9zVOYRdWoge0CnkXB7UdtfsA3h/RovelUsR30YXMLNOThcmNY5zWXcevyMIw/Q 3eCOD2nG2R+3aLqY8ZGWKCJx+9DiwE0RBwNrdkR2D3GjubNIVFOvyxH48FP0tMAON3 Uv+Gj6A4iEawWW7EDTGe4C0v6StfNftJ4zYbhw8s= Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relayfre-01.paragon-software.com (Postfix) with ESMTPS id 6C7481D0B; Tue, 7 Jun 2022 15:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1654617534; bh=gyeTbiR+uUhE29A+RGuh6i8rdvYUlUvUGCn1xr1k4cs=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=pqBlGqW6xS6n3BWqW/81M589K6ALyy85JH0UEAahiZxABf8Z0GwvzPioqJXHZnbLI clBXZyjEH412XG3NHfnqLNEBpR0dpNBqqz6lBPwotKWopecHCbnZ1gcz+qxKBVFj/o QvS+0J5c+2tkBgkcEFk+AsJMy1fcsjBc5QCxwimE= 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; Tue, 7 Jun 2022 18:58:54 +0300 Message-ID: <4f66239a-2209-6375-95ad-e8be0d28cf85@paragon-software.com> Date: Tue, 7 Jun 2022 18:58:53 +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: Remove a useless test Content-Language: en-US To: Christophe JAILLET 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/23/21 15:20, Christophe JAILLET wrote: > 'new_free' has just been allocated by kmalloc() and is known to be not > NULL. > So this pointer can't be equal to a previous memory allocation, or there > would be trouble in paradise. > > Axe the always true test and make the code more readable. > > Signed-off-by: Christophe JAILLET > --- > fs/ntfs3/bitmap.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/fs/ntfs3/bitmap.c b/fs/ntfs3/bitmap.c > index aa184407520f..e3b5680fd516 100644 > --- a/fs/ntfs3/bitmap.c > +++ b/fs/ntfs3/bitmap.c > @@ -1333,9 +1333,7 @@ int wnd_extend(struct wnd_bitmap *wnd, size_t new_bits) > if (!new_free) > return -ENOMEM; > > - if (new_free != wnd->free_bits) > - memcpy(new_free, wnd->free_bits, > - wnd->nwnd * sizeof(short)); > + memcpy(new_free, wnd->free_bits, wnd->nwnd * sizeof(short)); > memset(new_free + wnd->nwnd, 0, > (new_wnd - wnd->nwnd) * sizeof(short)); > kfree(wnd->free_bits); Thanks for patch, applied!