* [PATCH] Staging: rtl8188eu fix buffer overflow
@ 2015-03-20 14:21 Matteo Semenzato
2015-03-20 18:49 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Matteo Semenzato @ 2015-03-20 14:21 UTC (permalink / raw)
To: gregkh, navin.patidar, hejianet, sudipm.mukherjee
Cc: devel, linux-kernel, Matteo Semenzato
From: Matteo Semenzato <mattew8898@gmail.com>
This patch fixes the buffer overflow caused by accessing index 4 of hwxmits.
Signed-off-by: Matteo Semenzato <mattew8898@gmail.com>
---
drivers/staging/rtl8188eu/core/rtw_xmit.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 7a71df1..7b22779 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1631,10 +1631,12 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
{
struct hw_xmit *hwxmits;
struct xmit_priv *pxmitpriv = &padapter->xmitpriv;
+ size_t size;
pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
- pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+ size = sizeof(struct hw_xmit) * (pxmitpriv->hwxmit_entry + 1);
+ pxmitpriv->hwxmits = kzalloc(size, GFP_KERNEL);
hwxmits = pxmitpriv->hwxmits;
--
2.3.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Staging: rtl8188eu fix buffer overflow
2015-03-20 14:21 [PATCH] Staging: rtl8188eu fix buffer overflow Matteo Semenzato
@ 2015-03-20 18:49 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2015-03-20 18:49 UTC (permalink / raw)
To: Matteo Semenzato
Cc: gregkh, navin.patidar, hejianet, sudipm.mukherjee, devel,
linux-kernel
On Fri, Mar 20, 2015 at 03:21:40PM +0100, Matteo Semenzato wrote:
> From: Matteo Semenzato <mattew8898@gmail.com>
>
> This patch fixes the buffer overflow caused by accessing index 4 of hwxmits.
>
This is a Smatch warning? It's a false positive because the code that
accesses hwxmits[4] is dead code. Just delete it that section.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-20 18:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 14:21 [PATCH] Staging: rtl8188eu fix buffer overflow Matteo Semenzato
2015-03-20 18:49 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox