From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cong Wang Subject: Re: [PATCH net-next] net: remove redundant input checks in SIOCSIFTXQLEN case of dev_ifsioc Date: Mon, 23 Jul 2018 13:37:22 -0700 Message-ID: References: <1532011832-6952-1-git-send-email-tariqt@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: David Miller , Linux Kernel Network Developers , eranbe@mellanox.com To: Tariq Toukan Return-path: Received: from mail-pl0-f66.google.com ([209.85.160.66]:43136 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728308AbeGWVk2 (ORCPT ); Mon, 23 Jul 2018 17:40:28 -0400 Received: by mail-pl0-f66.google.com with SMTP id o7-v6so704625plk.10 for ; Mon, 23 Jul 2018 13:37:33 -0700 (PDT) In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Sun, Jul 22, 2018 at 12:29 AM Tariq Toukan wrote: > > > > On 19/07/2018 8:21 PM, Cong Wang wrote: > > On Thu, Jul 19, 2018 at 7:50 AM Tariq Toukan wrote: > >> --- a/net/core/dev_ioctl.c > >> +++ b/net/core/dev_ioctl.c > >> @@ -282,14 +282,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) > >> return dev_mc_del_global(dev, ifr->ifr_hwaddr.sa_data); > >> > >> case SIOCSIFTXQLEN: > >> - if (ifr->ifr_qlen < 0) > >> - return -EINVAL; > > > > Are you sure we can remove this if check too? > > > > The other one is safe to remove. > > > > Hmm, let's see: > dev_change_tx_queue_len gets unsigned long new_len, any negative value > passed is interpreted as a very large number, then we test: > if (new_len != (unsigned int)new_len) > > This test returns true if range of unsigned long is larger than range of > unsigned int. AFAIK these ranges are Arch dependent and there is no > guarantee this holds. > I am not sure either, you probably have to give it a test. And at least, explain it in changelog if you still want to remove it. Thanks.