* [PATCH] rtlwifi: rtl8192cu: Fix memset using sizeof(ptr) not sizeof(*ptr) @ 2011-05-09 5:43 Joe Perches 2011-05-09 16:02 ` Larry Finger 0 siblings, 1 reply; 5+ messages in thread From: Joe Perches @ 2011-05-09 5:43 UTC (permalink / raw) To: Larry Finger, Chaoming Li; +Cc: John W. Linville, linux-wireless, netdev, LKML Found via coccinelle script @@ type T; T* ptr; expression E1; @@ * memset(E1, 0, sizeof(ptr)); Signed-off-by: Joe Perches <joe@perches.com> --- drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 79c98f6..c16fc1c 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) __le16 fc; struct ieee80211_hdr *hdr; - memset(rx_status, 0, sizeof(rx_status)); + memset(rx_status, 0, sizeof(*rx_status)); rxdesc = skb->data; skb_len = skb->len; drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] rtlwifi: rtl8192cu: Fix memset using sizeof(ptr) not sizeof(*ptr) 2011-05-09 5:43 [PATCH] rtlwifi: rtl8192cu: Fix memset using sizeof(ptr) not sizeof(*ptr) Joe Perches @ 2011-05-09 16:02 ` Larry Finger 2011-05-09 17:09 ` [PATCH V2] rtlwifi: rtl8192cu: Fix memset/memcpy " Joe Perches 0 siblings, 1 reply; 5+ messages in thread From: Larry Finger @ 2011-05-09 16:02 UTC (permalink / raw) To: Joe Perches; +Cc: Chaoming Li, John W. Linville, linux-wireless, netdev, LKML On 05/09/2011 12:43 AM, Joe Perches wrote: > Found via coccinelle script > > @@ > type T; > T* ptr; > expression E1; > @@ > > * memset(E1, 0, sizeof(ptr)); > > Signed-off-by: Joe Perches<joe@perches.com> > --- > drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > index 79c98f6..c16fc1c 100644 > --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) > __le16 fc; > struct ieee80211_hdr *hdr; > > - memset(rx_status, 0, sizeof(rx_status)); > + memset(rx_status, 0, sizeof(*rx_status)); > rxdesc = skb->data; > skb_len = skb->len; > drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); ACK. Larry ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2] rtlwifi: rtl8192cu: Fix memset/memcpy using sizeof(ptr) not sizeof(*ptr) 2011-05-09 16:02 ` Larry Finger @ 2011-05-09 17:09 ` Joe Perches 2011-05-09 19:28 ` Larry Finger 0 siblings, 1 reply; 5+ messages in thread From: Joe Perches @ 2011-05-09 17:09 UTC (permalink / raw) To: Larry Finger; +Cc: Chaoming Li, John W. Linville, linux-wireless, netdev, LKML On Mon, 2011-05-09 at 11:02 -0500, Larry Finger wrote: > On 05/09/2011 12:43 AM, Joe Perches wrote: > > Found via coccinelle script > > @@ > > type T; > > T* ptr; > > expression E1; > > @@ > > * memset(E1, 0, sizeof(ptr)); > > Signed-off-by: Joe Perches<joe@perches.com> > > --- > > drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > > > diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > > @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) [] > > + memset(rx_status, 0, sizeof(*rx_status)); > ACK. Hey Larry. If this is correct, then probably the memcpy at the end of the routine needs conversion too. --- drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 79c98f6..3a92ba3 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) __le16 fc; struct ieee80211_hdr *hdr; - memset(rx_status, 0, sizeof(rx_status)); + memset(rx_status, 0, sizeof(*rx_status)); rxdesc = skb->data; skb_len = skb->len; drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); @@ -434,7 +434,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) "0x%02X\n", fc, (u32)hdr->addr1[0], (u32)hdr->addr1[1], (u32)hdr->addr1[2], (u32)hdr->addr1[3], (u32)hdr->addr1[4], (u32)hdr->addr1[5])); - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); + memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); ieee80211_rx_irqsafe(hw, skb); } ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] rtlwifi: rtl8192cu: Fix memset/memcpy using sizeof(ptr) not sizeof(*ptr) 2011-05-09 17:09 ` [PATCH V2] rtlwifi: rtl8192cu: Fix memset/memcpy " Joe Perches @ 2011-05-09 19:28 ` Larry Finger 2011-05-09 19:51 ` [PATCH V3] " Joe Perches 0 siblings, 1 reply; 5+ messages in thread From: Larry Finger @ 2011-05-09 19:28 UTC (permalink / raw) To: Joe Perches; +Cc: Chaoming Li, John W. Linville, linux-wireless, netdev, LKML On 05/09/2011 12:09 PM, Joe Perches wrote: > On Mon, 2011-05-09 at 11:02 -0500, Larry Finger wrote: >> On 05/09/2011 12:43 AM, Joe Perches wrote: >>> Found via coccinelle script >>> @@ >>> type T; >>> T* ptr; >>> expression E1; >>> @@ >>> * memset(E1, 0, sizeof(ptr)); >>> Signed-off-by: Joe Perches<joe@perches.com> >>> --- >>> drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 2 +- >>> 1 files changed, 1 insertions(+), 1 deletions(-) >>> >>> diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c >>> @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) > [] >>> + memset(rx_status, 0, sizeof(*rx_status)); >> ACK. > > Hey Larry. > > If this is correct, then probably the memcpy at the > end of the routine needs conversion too. > > --- > > drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > index 79c98f6..3a92ba3 100644 > --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c > @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) > __le16 fc; > struct ieee80211_hdr *hdr; > > - memset(rx_status, 0, sizeof(rx_status)); > + memset(rx_status, 0, sizeof(*rx_status)); > rxdesc = skb->data; > skb_len = skb->len; > drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); > @@ -434,7 +434,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) > "0x%02X\n", fc, (u32)hdr->addr1[0], (u32)hdr->addr1[1], > (u32)hdr->addr1[2], (u32)hdr->addr1[3], (u32)hdr->addr1[4], > (u32)hdr->addr1[5])); > - memcpy(IEEE80211_SKB_RXCB(skb),&rx_status, sizeof(rx_status)); > + memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); > ieee80211_rx_irqsafe(hw, skb); > } Yes it does. After you posted V1 of the patch, I reviewed all the sizeof() calls in the rtlwifi tree and found the second one at line 437. ACK for V2 once the commit message is fixed. Larry ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V3] rtlwifi: rtl8192cu: Fix memset/memcpy using sizeof(ptr) not sizeof(*ptr) 2011-05-09 19:28 ` Larry Finger @ 2011-05-09 19:51 ` Joe Perches 0 siblings, 0 replies; 5+ messages in thread From: Joe Perches @ 2011-05-09 19:51 UTC (permalink / raw) To: Larry Finger; +Cc: Chaoming Li, John W. Linville, linux-wireless, netdev, LKML Found via coccinelle script @@ type T; T* ptr; expression E1; @@ * memset(E1, 0, sizeof(ptr)); Signed-off-by: Joe Perches <joe@perches.com> --- drivers/net/wireless/rtlwifi/rtl8192cu/trx.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c index 79c98f6..3a92ba3 100644 --- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c +++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c @@ -372,7 +372,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) __le16 fc; struct ieee80211_hdr *hdr; - memset(rx_status, 0, sizeof(rx_status)); + memset(rx_status, 0, sizeof(*rx_status)); rxdesc = skb->data; skb_len = skb->len; drvinfo_len = (GET_RX_DESC_DRVINFO_SIZE(rxdesc) * RTL_RX_DRV_INFO_UNIT); @@ -434,7 +434,7 @@ static void _rtl_rx_process(struct ieee80211_hw *hw, struct sk_buff *skb) "0x%02X\n", fc, (u32)hdr->addr1[0], (u32)hdr->addr1[1], (u32)hdr->addr1[2], (u32)hdr->addr1[3], (u32)hdr->addr1[4], (u32)hdr->addr1[5])); - memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status)); + memcpy(IEEE80211_SKB_RXCB(skb), rx_status, sizeof(*rx_status)); ieee80211_rx_irqsafe(hw, skb); } ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-09 19:51 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-09 5:43 [PATCH] rtlwifi: rtl8192cu: Fix memset using sizeof(ptr) not sizeof(*ptr) Joe Perches 2011-05-09 16:02 ` Larry Finger 2011-05-09 17:09 ` [PATCH V2] rtlwifi: rtl8192cu: Fix memset/memcpy " Joe Perches 2011-05-09 19:28 ` Larry Finger 2011-05-09 19:51 ` [PATCH V3] " Joe Perches
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).