Search Linux Wireless

Re: [PATCH] wireless-regdb: sanity checks on freq range

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 6, 2009 at 16:17, Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx> wrote:
> diff --git a/dbparse.py b/dbparse.py
> index 55615bd..dd64927 100755
> --- a/dbparse.py
> +++ b/dbparse.py
> @@ -136,6 +136,19 @@ class DBParser(object):
>             start, end = freqs.split('-')
>             start = float(start)
>             end = float(end)
> +            # The kernel will reject these, so might as well reject this
> +            # upon building it.
> +            if start <= 0:
> +               self._syntax_error("Invalid start freq (%d)" % start)
> +            if end <= 0:
> +               self._syntax_error("Invalid end freq (%d)" % end)
> +            if start > end:
> +               self._syntax_error("Inverted freq range it seems (%d - %d)" % (start, end))

"Inverted freq range" only?

> +            if end - start <= 0:
> +               self._syntax_error("Invalid bandwidth (%d)" % bw)

This is equivalent to "end <= start" which is equivalent to "start >=
end" which is mostly covered by the previous test.

Wouldn't it be clearer to have something like: (I don't have
Python-fu, so take this with salt)
if start == end:
    self._syntax_error("Start and end freqs are equivalent")

Thanks,

-- 

Julian Calaby

Email: julian.calaby@xxxxxxxxx
.Plan: http://sites.google.com/site/juliancalaby/
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux