Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp947873pxb; Wed, 16 Feb 2022 07:45:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJzdWJSdevtz2tVOj5cpmO1iWTUkhmJ2od9QFzirJuZez96w0xh5HJJcHm3g9VafT0XAicLG X-Received: by 2002:a05:6402:42c9:b0:407:f86c:44e7 with SMTP id i9-20020a05640242c900b00407f86c44e7mr3678469edc.230.1645026307662; Wed, 16 Feb 2022 07:45:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645026307; cv=none; d=google.com; s=arc-20160816; b=gQU4yfkaD+lmSaVJfB0/dXps/o/cTspOzWD/A1gKlx5F6VZuT6SUR44/3YC1Ezd8eT Io0Sx6Ai3e2nXseJrmzyJ1RzfFF4B1rHgMYuE7Jx1SNz2Rz8bC6fa/TyWulzEqzff6O7 oBaO0JrrgIdeFvJFYjC+4NWDUhD96PtN2cVnET9MoqhurOlDhE5hxzkJMByZeLp17hnM nVVVjXMQBcMZmW+pkkx1E2BEUP26n535rHqmYEAPa6MNZNmv98YbjwmnHn8x4M5Yi+TC 3jeDhpyfZhheaoTx9lvLCnGh50zgIGMuczJbf9qQvGMZGj0Wx9+PElqp1MFYQEr/8/63 Z8Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BKdxU5DADwVto3Is7HaB7C+sQCcV3ltmCY8rgD210WI=; b=yP06dLwzseC+Hn0p6JjmpuLQqxdcWz3z1EOhFHeIZ5O9XJ8LPLWK+6ST6cul1X0UW+ RWIqYJsnWgyA/zHmHpsYaIMuE2JND8NuEBFEXthguuO0e6Y8ubP9sgmGPPCQea0KqPu0 IxG8tVhDrsPaiCwott5rFfzdZsA3YXD1WTY/ycjMZtNvI82Lcfe09en4M35uBkv491cq js/wUqbGM9L8QyMu1ZogI8YeqUXDMMQY9ZdDpF+8QSqivArWM5CJFaEEzqx9Td/fD+NO VyzJiAY2mNISxEFH58nqmT3d1E+SYkVBrFq2/NoZQ0X6xKFP6C71aYFzW/v4Byp9wm0C CojQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QBAxkdeq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd7si77029ejc.313.2022.02.16.07.44.32; Wed, 16 Feb 2022 07:45:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=QBAxkdeq; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234605AbiBPPbU (ORCPT + 99 others); Wed, 16 Feb 2022 10:31:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232213AbiBPPbU (ORCPT ); Wed, 16 Feb 2022 10:31:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD52025FE76; Wed, 16 Feb 2022 07:31:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EF4CB81F21; Wed, 16 Feb 2022 15:31:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43651C340EC; Wed, 16 Feb 2022 15:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645025465; bh=+mxHrEYwkMd2fk54e3DcdNfYs6uxnmbr/MlR0kHgo3c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QBAxkdeqzN+Mt0h2RAGjvupG/fpQXDyq5/WPFnEbX7KMQryTlA04mocuQ522Tppv7 J84BHaYteO4GdWMfjsNzedmoyn19PXfHR+e7twtgRakCnbhYF+Bl6H/QQwx1UM44d0 wjgYKrvfgRCdEQB1rF3TlfS+jRvjxizAxRp15FWj8mLEHcAyn6lIuNb38EeHwf9bDz X7E9h32UpgejD/CutA9VXecS8kJu/bjjfhEyX5lTYsjfrFtlTUPGXoTsmf+/X7Wnug ClhqnzuLsqx+ufu9ANfvdiu67PiV3RUPzc/fI8wtrCYaTDdPL3j+d4aT/JJQOZog4a f0gCqKI6++J/A== Received: by mail-wm1-f50.google.com with SMTP id n8so1437711wms.3; Wed, 16 Feb 2022 07:31:05 -0800 (PST) X-Gm-Message-State: AOAM531GWX3rq0ROS3WzsN9899FcxD+bMXfBHmT1RovExgHDPWN2ldjL +jr1riY9alxTFvcqTCQFKRoFK9qvWAOpBMUUAtQ= X-Received: by 2002:a7b:c844:0:b0:37b:b986:7726 with SMTP id c4-20020a7bc844000000b0037bb9867726mr2146608wml.160.1645025463924; Wed, 16 Feb 2022 07:31:03 -0800 (PST) MIME-Version: 1.0 References: <1644920224-24966-1-git-send-email-khoroshilov@ispras.ru> In-Reply-To: <1644920224-24966-1-git-send-email-khoroshilov@ispras.ru> From: Anna Schumaker Date: Wed, 16 Feb 2022 10:30:47 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] NFS: remove unneeded check in decode_devicenotify_args() To: Alexey Khoroshilov Cc: Trond Myklebust , Linux NFS Mailing List , Linux Kernel Mailing List , ldv-project@linuxtesting.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-nfs@vger.kernel.org Hi Alexey, On Tue, Feb 15, 2022 at 5:17 AM Alexey Khoroshilov wrote: > > Overflow check in not needed anymore after we switch to kmalloc_array(). Don't we still need the overflow check since 'n' is used in the for-loop end condition farther down in this function? Thanks, Anna > > Signed-off-by: Alexey Khoroshilov > Fixes: a4f743a6bb20 ("NFSv4.1: Convert open-coded array allocation calls to kmalloc_array()") > --- > fs/nfs/callback_xdr.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c > index f90de8043b0f..8dcb08e1a885 100644 > --- a/fs/nfs/callback_xdr.c > +++ b/fs/nfs/callback_xdr.c > @@ -271,10 +271,6 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, > n = ntohl(*p++); > if (n == 0) > goto out; > - if (n > ULONG_MAX / sizeof(*args->devs)) { > - status = htonl(NFS4ERR_BADXDR); > - goto out; > - } > > args->devs = kmalloc_array(n, sizeof(*args->devs), GFP_KERNEL); > if (!args->devs) { > -- > 2.7.4 >