Re: [PATCH v2] hdlcdrv: fix divide error bug if bitrate is 0

2017-05-19 Thread David Miller
From: Firo Yang 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 (!n

[PATCH v2] hdlcdrv: fix divide error bug if bitrate is 0

2017-05-19 Thread Firo Yang
The divisor s->par.bitrate will always be 0 until initialized by ndo_open() and hdlcdrv_open(). In order to fix this divide zero error, check whether the netdevice was opened by ndo_open() before performing divide.And we also check the the value of bitrate in case of bad setting of it. Reported-b