* [PATCH 1/3] ath5k: drop useless comparison
@ 2014-08-22 13:18 Bob Copeland
2014-08-22 13:18 ` [PATCH 2/3] ath5k: ensure led name is null terminated Bob Copeland
2014-08-22 13:18 ` [PATCH 3/3] ath5k: remove redundant null check before kfree() Bob Copeland
0 siblings, 2 replies; 3+ messages in thread
From: Bob Copeland @ 2014-08-22 13:18 UTC (permalink / raw)
To: linville, mickflemm; +Cc: ath5k-devel, linux-wireless, Bob Copeland
rxs->rate_idx is unsigned, so it will always be >= 0.
Found by Coverity.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
John & Nick,
This and the next two patches are some simple cleanups from static
checkers, but no actual bugs here, so they can wait for 3.18.
drivers/net/wireless/ath/ath5k/base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index ef35da8..03ab134 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1417,7 +1417,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
break;
}
- if (rxs->rate_idx >= 0 && rs->rs_rate ==
+ if (rs->rs_rate ==
ah->sbands[ah->curchan->band].bitrates[rxs->rate_idx].hw_value_short)
rxs->flag |= RX_FLAG_SHORTPRE;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] ath5k: ensure led name is null terminated
2014-08-22 13:18 [PATCH 1/3] ath5k: drop useless comparison Bob Copeland
@ 2014-08-22 13:18 ` Bob Copeland
2014-08-22 13:18 ` [PATCH 3/3] ath5k: remove redundant null check before kfree() Bob Copeland
1 sibling, 0 replies; 3+ messages in thread
From: Bob Copeland @ 2014-08-22 13:18 UTC (permalink / raw)
To: linville, mickflemm; +Cc: ath5k-devel, linux-wireless, Bob Copeland
Add the missing null termination after strncpy().
This isn't actually a buffer overflow in this case since we use
snprintf() appropriately to fill the buffer passed by the caller,
but in the interest of not turning this into a bug down the road,
go ahead and force termination here.
Found by Coverity.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
drivers/net/wireless/ath/ath5k/led.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
index f77ef36..edc32ea 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -130,6 +130,7 @@ ath5k_register_led(struct ath5k_hw *ah, struct ath5k_led *led,
led->ah = ah;
strncpy(led->name, name, sizeof(led->name));
+ led->name[sizeof(led->name)-1] = 0;
led->led_dev.name = led->name;
led->led_dev.default_trigger = trigger;
led->led_dev.brightness_set = ath5k_led_brightness_set;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] ath5k: remove redundant null check before kfree()
2014-08-22 13:18 [PATCH 1/3] ath5k: drop useless comparison Bob Copeland
2014-08-22 13:18 ` [PATCH 2/3] ath5k: ensure led name is null terminated Bob Copeland
@ 2014-08-22 13:18 ` Bob Copeland
1 sibling, 0 replies; 3+ messages in thread
From: Bob Copeland @ 2014-08-22 13:18 UTC (permalink / raw)
To: linville, mickflemm; +Cc: ath5k-devel, linux-wireless, Bob Copeland
kfree() null-checks its argument.
Found by smatch.
Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
drivers/net/wireless/ath/ath5k/attach.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/attach.c b/drivers/net/wireless/ath/ath5k/attach.c
index 7106547..66b6366 100644
--- a/drivers/net/wireless/ath/ath5k/attach.c
+++ b/drivers/net/wireless/ath/ath5k/attach.c
@@ -351,8 +351,7 @@ void ath5k_hw_deinit(struct ath5k_hw *ah)
{
__set_bit(ATH_STAT_INVALID, ah->status);
- if (ah->ah_rf_banks != NULL)
- kfree(ah->ah_rf_banks);
+ kfree(ah->ah_rf_banks);
ath5k_eeprom_detach(ah);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-22 13:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22 13:18 [PATCH 1/3] ath5k: drop useless comparison Bob Copeland
2014-08-22 13:18 ` [PATCH 2/3] ath5k: ensure led name is null terminated Bob Copeland
2014-08-22 13:18 ` [PATCH 3/3] ath5k: remove redundant null check before kfree() Bob Copeland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.