Skip to content

Commit

Permalink
cfg80211: test before subtraction on unsigned
Browse files Browse the repository at this point in the history
freq_diff is unsigned, so test before subtraction

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Roel Kluin authored and John W. Linville committed Mar 6, 2009
1 parent 623d563 commit bd05f28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/wireless/reg.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ static bool is_valid_reg_rule(const struct ieee80211_reg_rule *rule)

freq_diff = freq_range->end_freq_khz - freq_range->start_freq_khz;

if (freq_diff <= 0 || freq_range->max_bandwidth_khz > freq_diff)
if (freq_range->end_freq_khz <= freq_range->start_freq_khz ||
freq_range->max_bandwidth_khz > freq_diff)
return false;

return true;
Expand Down

0 comments on commit bd05f28

Please sign in to comment.