Do sanity checks on the frequency range before building upon it. The kernel will reject these so we want to know if we goofed up first. Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx> --- My python-fu sucks. But at least it bails out on errors. dbparse.py | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) 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)) + if end - start <= 0: + self._syntax_error("Invalid bandwidth (%d)" % bw) + if end - start < bw: + self._syntax_error("Invalid bandwidth: %d width channel " + "cannot possibly fit between %d - %d" % (bw, start, end)) except ValueError: self._syntax_error("band must have frequency range") -- 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