[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170519.174117.491042433043886205.davem@davemloft.net>
Date: Fri, 19 May 2017 17:41:17 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: firogm@...il.com
Cc: t.sailer@...mni.ethz.ch, wharms@....de, andreyknvl@...gle.com,
linux-hams@...r.kernel.org, gregkh@...uxfoundation.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v2] hdlcdrv: fix divide error bug if bitrate is 0
From: Firo Yang <firogm@...il.com>
Date: Fri, 19 May 2017 21:21:46 +0800
> @@ -576,6 +576,10 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
> case HDLCDRVCTL_CALIBRATE:
> if(!capable(CAP_SYS_RAWIO))
> return -EPERM;
> + if (!netif_running(dev))
> + return -ENODEV;
> + if (!(s->par.bitrate > 0))
> + return -EINVAL;
This test is so un-canonical and convoluted.
Please use something more straightforward. I really think Alan
Cox's patch handled this more cleanly. Make the test something
like "if (x <= 0) return -EINVAL;".
I also am not convinced about the netif_running() test and at
best it is a separate change from this divide by zero bug fix
so belongs in a separate patch.
Thank you.
Powered by blists - more mailing lists