Staging: vt6655: Fix sparse-indicated type mismatch to kmalloc
PATCH 1/1 Staging: vt6655: Fix sparse-indicated type mismatch to kmalloc
---
Patch is against next-20140320. Fixes a minor sparse warning in the staging driver vt6655. p->length is u16; implicit cast to size_t is fine. No reason to cast GFP_KERNEL...
--- drivers/staging/vt6655/wpactl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/wpactl.c +1 -1
@@ -855,11 +855,11 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p)if (p->length <sizeof (struct viawget_wpa_param ) || p->length >VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)return -EINVAL ; - param =kmalloc ((int )p->length, (int )GFP_KERNEL ); + param =kmalloc (p->length,GFP_KERNEL );if (param ==NULL )return -ENOMEM ;if (copy_from_user (param, p->pointer, p->length)) { ret = -EFAULT ;
Signature · 1 line
1.8.5.3
cover remove wrong cast of gfp_t flags
From: Silvio F <[email protected]>
Hi,
I have seen this patch, but in this and two other files we have the same wrong casting.
This three little patches remove wrong cast for gfp_t-flags in kamlloc, kzalloc, ...
Please review this patch.
These patches are WIP because I have no hardware and can only do a compile test.
Cheers,
Silvio
Silvio F (3):
staging: vt6655: removed incorrect casting in wpactl.c
staging: vt6655: removed incorrect casting in ioctl.c
staging: vt6655: removed incorrect casting in iwctl.c
drivers/staging/vt6655/ioctl.c | 6 ++++-- drivers/staging/vt6655/iwctl.c | 2 +- drivers/staging/vt6655/wpactl.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.0
PATCH 1/3 staging: vt6655: removed incorrect casting in wpactl.c
From: Silvio F <[email protected]>
This patch fixes the following type of sparse warnings:
drivers/staging/vt6655/wpactl.c:596:47: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:638:68: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:860:42: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/wpactl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6655/wpactl.c +3 -3
@@ -593,7 +593,7 @@ static int wpa_get_scan(PSDevice pDevice,unsigned char *ptempBSS; - ptempBSS =kmalloc (sizeof (KnownBSS), (int )GFP_ATOMIC ); + ptempBSS =kmalloc (sizeof (KnownBSS),GFP_ATOMIC );if (ptempBSS ==NULL ) {printk (KERN_ERR "bubble sort kmalloc memory fail@@@\n" );
@@ -635,7 +635,7 @@ static int wpa_get_scan(PSDevice pDevice, count++; } - pBuf =kcalloc (count,sizeof (struct viawget_scan_result ), (int )GFP_ATOMIC ); + pBuf =kcalloc (count,sizeof (struct viawget_scan_result ),GFP_ATOMIC );if (pBuf ==NULL ) { ret = -ENOMEM ;
@@ -857,7 +857,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)return -EINVAL ; - param =kmalloc ((int )p->length, (int )GFP_KERNEL ); + param =kmalloc ((int )p->length,GFP_KERNEL );if (param ==NULL )return -ENOMEM ;
Signature · 1 line
1.9.0
Re: [PATCH 1/3] staging: vt6655: removed incorrect casting in wpactl.c
Quoted 1 line · On Tue, Mar 25, 2014 at 09:30:18PM +0100, [email protected] wrote:
From: Silvio F <[email protected]>
Don't use this header for your own patches.
Quoted 8 lines
This patch fixes the following type of sparse warnings:
drivers/staging/vt6655/wpactl.c:596:47: warning: cast from restrictedgfp_tdrivers/staging/vt6655/wpactl.c:638:68: warning: cast from restrictedgfp_tdrivers/staging/vt6655/wpactl.c:860:42: warning: cast from restrictedgfp_tSigned-off-by Silvio F <[email protected]>
We can't verify this is you if you don't send from the same email you sign off by. We can't really verify perfectly anyway, of course, but at least we try do the minimum.
regards,
dan carpenter
v2 cover remove wrong cast of gfp_t flags
Hi Dan,
thanks for your review.
Attached second version of this series.
Cheers,
Silvio
Silvio Fricke (3):
staging: vt6655: removed incorrect casting in wpactl.c
staging: vt6655: removed incorrect casting in ioctl.c
staging: vt6655: removed incorrect casting in iwctl.c
drivers/staging/vt6655/ioctl.c | 6 ++++-- drivers/staging/vt6655/iwctl.c | 2 +- drivers/staging/vt6655/wpactl.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.0
PATCH v2 1/3 staging: vt6655: removed incorrect casting in wpactl.c
This patch fixes the following type of sparse warnings:
drivers/staging/vt6655/wpactl.c:596:47: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:638:68: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:860:42: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/wpactl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6655/wpactl.c +3 -3
@@ -593,7 +593,7 @@ static int wpa_get_scan(PSDevice pDevice,unsigned char *ptempBSS; - ptempBSS =kmalloc (sizeof (KnownBSS), (int )GFP_ATOMIC ); + ptempBSS =kmalloc (sizeof (KnownBSS),GFP_ATOMIC );if (ptempBSS ==NULL ) {printk (KERN_ERR "bubble sort kmalloc memory fail@@@\n" );
@@ -635,7 +635,7 @@ static int wpa_get_scan(PSDevice pDevice, count++; } - pBuf =kcalloc (count,sizeof (struct viawget_scan_result ), (int )GFP_ATOMIC ); + pBuf =kcalloc (count,sizeof (struct viawget_scan_result ),GFP_ATOMIC );if (pBuf ==NULL ) { ret = -ENOMEM ;
@@ -857,7 +857,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)return -EINVAL ; - param =kmalloc ((int )p->length, (int )GFP_KERNEL ); + param =kmalloc ((int )p->length,GFP_KERNEL );if (param ==NULL )return -ENOMEM ;
Signature · 1 line
1.9.0
PATCH v2 2/3 staging: vt6655: removed incorrect casting in ioctl.c
In reply to Silvio FrickeThis patch fixes the following type of sparse warnings:
drivers/staging/vt6655/ioctl.c:308:104: warning: cast from restricted gfp_t drivers/staging/vt6655/ioctl.c:579:109: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/ioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6655/ioctl.c +4 -2
@@ -305,7 +305,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), (int )GFP_ATOMIC ); + pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), +GFP_ATOMIC );if (pList ==NULL ) { result = -ENOMEM ;break ;
@@ -576,7 +577,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), (int )GFP_ATOMIC ); + pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), +GFP_ATOMIC );if (pNodeList ==NULL ) { result = -ENOMEM ;break ;
Signature · 1 line
1.9.0
PATCH v2 3/3 staging: vt6655: removed incorrect casting in iwctl.c
In reply to Silvio FrickeThis patch fixes the following type of sparse warning:
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iwctl.c +1 -1
@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,PRINT_K ("SIOCSIWENCODEEXT...... \n" ); blen =sizeof (*param); - buf =kmalloc ((int )blen, (int )GFP_KERNEL ); + buf =kmalloc ((int )blen,GFP_KERNEL );if (buf ==NULL )return -ENOMEM ;memset (buf,0 , blen);
Signature · 1 line
1.9.0
Re: [WIP] [PATCH v2 0/3] remove wrong cast of gfp_t flags
In reply to Silvio FrickeQuoted 4 lines · Silvio Fricke
Hi Dan,
thanks for your review.
Attached second version of this series.
I don't understand what the [WIP] marking is. Please just resend these as "real" patches if you feel they are ready to be merged. If we have issues with them, we will be sure to let you know :)
thanks,
greg k-h
v3 cover remove wrong cast of gfp_t flags
Hi,
Quoted 6 lines
Quoted 2 lines
thanks for your review.
Attached second version of this series.I don't understand what the [WIP] marking is. Please just resend these as "real" patches if you feel they are ready to be merged. If we have issues with them, we will be sure to let you know :)
I removed it.
Bye,
Silvio
v3: * no 'WIP'! Don't do that!
v2: * signed-off and message are not the same address
Silvio Fricke (3):
staging: vt6655: removed incorrect casting in wpactl.c
staging: vt6655: removed incorrect casting in ioctl.c
staging: vt6655: removed incorrect casting in iwctl.c
drivers/staging/vt6655/ioctl.c | 6 ++++-- drivers/staging/vt6655/iwctl.c | 2 +- drivers/staging/vt6655/wpactl.c | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.2
PATCH v3 1/3 staging: vt6655: removed incorrect casting in wpactl.c
This patch fixes the following type of sparse warnings:
drivers/staging/vt6655/wpactl.c:596:47: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:638:68: warning: cast from restricted gfp_t drivers/staging/vt6655/wpactl.c:860:42: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/wpactl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vt6655/wpactl.c +3 -3
@@ -593,7 +593,7 @@ static int wpa_get_scan(PSDevice pDevice,unsigned char *ptempBSS; - ptempBSS =kmalloc (sizeof (KnownBSS), (int )GFP_ATOMIC ); + ptempBSS =kmalloc (sizeof (KnownBSS),GFP_ATOMIC );if (ptempBSS ==NULL ) {printk (KERN_ERR "bubble sort kmalloc memory fail@@@\n" );
@@ -635,7 +635,7 @@ static int wpa_get_scan(PSDevice pDevice, count++; } - pBuf =kcalloc (count,sizeof (struct viawget_scan_result ), (int )GFP_ATOMIC ); + pBuf =kcalloc (count,sizeof (struct viawget_scan_result ),GFP_ATOMIC );if (pBuf ==NULL ) { ret = -ENOMEM ;
@@ -857,7 +857,7 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) p->length > VIAWGET_WPA_MAX_BUF_SIZE || !p->pointer)return -EINVAL ; - param =kmalloc ((int )p->length, (int )GFP_KERNEL ); + param =kmalloc ((int )p->length,GFP_KERNEL );if (param ==NULL )return -ENOMEM ;
Signature · 1 line
1.9.2
PATCH v3 2/3 staging: vt6655: removed incorrect casting in ioctl.c
In reply to Silvio FrickeThis patch fixes the following type of sparse warnings:
drivers/staging/vt6655/ioctl.c:308:104: warning: cast from restricted gfp_t drivers/staging/vt6655/ioctl.c:579:109: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/ioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6655/ioctl.c +4 -2
@@ -305,7 +305,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), (int )GFP_ATOMIC ); + pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), +GFP_ATOMIC );if (pList ==NULL ) { result = -ENOMEM ;break ;
@@ -576,7 +577,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), (int )GFP_ATOMIC ); + pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), +GFP_ATOMIC );if (pNodeList ==NULL ) { result = -ENOMEM ;break ;
Signature · 1 line
1.9.2
PATCH v3 3/3 staging: vt6655: removed incorrect casting in iwctl.c
In reply to Silvio FrickeThis patch fixes the following type of sparse warning:
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iwctl.c +1 -1
@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,PRINT_K ("SIOCSIWENCODEEXT...... \n" ); blen =sizeof (*param); - buf =kmalloc ((int )blen, (int )GFP_KERNEL ); + buf =kmalloc ((int )blen,GFP_KERNEL );if (buf ==NULL )return -ENOMEM ;memset (buf,0 , blen);
Signature · 1 line
1.9.2
PATCH 2/3 staging: vt6655: removed incorrect casting in ioctl.c
In reply to [email protected]From: Silvio F <[email protected]>
This patch fixes the following type of sparse warnings:
drivers/staging/vt6655/ioctl.c:308:104: warning: cast from restricted gfp_t drivers/staging/vt6655/ioctl.c:579:109: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/ioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/vt6655/ioctl.c +4 -2
@@ -305,7 +305,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), (int )GFP_ATOMIC ); + pList = (PSBSSIDList )kmalloc (sizeof (SBSSIDList) + (sList.uItem *sizeof (SBSSIDItem)), +GFP_ATOMIC );if (pList ==NULL ) { result = -ENOMEM ;break ;
@@ -576,7 +577,8 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) result = -EINVAL ;break ; } - pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), (int )GFP_ATOMIC ); + pNodeList = (PSNodeList )kmalloc (sizeof (SNodeList) + (sNodeList.uItem *sizeof (SNodeItem)), +GFP_ATOMIC );if (pNodeList ==NULL ) { result = -ENOMEM ;break ;
Signature · 1 line
1.9.0
PATCH 3/3 staging: vt6655: removed incorrect casting in iwctl.c
In reply to [email protected]From: Silvio F <[email protected]>
This patch fixes the following type of sparse warning:
drivers/staging/vt6655/iwctl.c:1846:35: warning: cast from restricted gfp_t
--- drivers/staging/vt6655/iwctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/vt6655/iwctl.c +1 -1
@@ -1843,7 +1843,7 @@ int iwctl_siwencodeext(struct net_device *dev,PRINT_K ("SIOCSIWENCODEEXT...... \n" ); blen =sizeof (*param); - buf =kmalloc ((int )blen, (int )GFP_KERNEL ); + buf =kmalloc ((int )blen,GFP_KERNEL );if (buf ==NULL )return -ENOMEM ;memset (buf,0 , blen);
Signature · 1 line
1.9.0