linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Thermal/int340x: avoid unnecessary pointer casting
@ 2014-11-04 23:53 Jacob Pan
  2014-11-07 19:06 ` Eduardo Valentin
  2014-11-19  8:31 ` Zhang Rui
  0 siblings, 2 replies; 3+ messages in thread
From: Jacob Pan @ 2014-11-04 23:53 UTC (permalink / raw)
  To: Linux PM; +Cc: Dan Carpenter, Zhang Rui, Rafael Wysocki, Jacob Pan

Avoid pointer casting which may also lead to problems on big endian
64 bit systems.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
---
 drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
index 0d8db80..ac5c405 100644
--- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
+++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
@@ -317,21 +317,21 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
 {
 	int ret = 0;
 	unsigned long length = 0;
-	unsigned long count = 0;
+	int count = 0;
 	char __user *arg = (void __user *)__arg;
 	struct trt *trts;
 	struct art *arts;
 
 	switch (cmd) {
 	case ACPI_THERMAL_GET_TRT_COUNT:
-		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
+		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
 				&trts, false);
 		kfree(trts);
 		if (!ret)
 			return put_user(count, (unsigned long __user *)__arg);
 		return ret;
 	case ACPI_THERMAL_GET_TRT_LEN:
-		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
+		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
 				&trts, false);
 		kfree(trts);
 		length = count * sizeof(union trt_object);
@@ -341,14 +341,14 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
 	case ACPI_THERMAL_GET_TRT:
 		return fill_trt(arg);
 	case ACPI_THERMAL_GET_ART_COUNT:
-		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
+		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
 				&arts, false);
 		kfree(arts);
 		if (!ret)
 			return put_user(count, (unsigned long __user *)__arg);
 		return ret;
 	case ACPI_THERMAL_GET_ART_LEN:
-		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
+		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
 				&arts, false);
 		kfree(arts);
 		length = count * sizeof(union art_object);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Thermal/int340x: avoid unnecessary pointer casting
  2014-11-04 23:53 [PATCH] Thermal/int340x: avoid unnecessary pointer casting Jacob Pan
@ 2014-11-07 19:06 ` Eduardo Valentin
  2014-11-19  8:31 ` Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Eduardo Valentin @ 2014-11-07 19:06 UTC (permalink / raw)
  To: Jacob Pan; +Cc: Linux PM, Dan Carpenter, Zhang Rui, Rafael Wysocki

[-- Attachment #1: Type: text/plain, Size: 2582 bytes --]

Hello,

On Tue, Nov 04, 2014 at 03:53:34PM -0800, Jacob Pan wrote:
> Avoid pointer casting which may also lead to problems on big endian
> 64 bit systems.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
> ---
>  drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> index 0d8db80..ac5c405 100644
> --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> @@ -317,21 +317,21 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
>  {
>  	int ret = 0;
>  	unsigned long length = 0;
> -	unsigned long count = 0;
> +	int count = 0;
>  	char __user *arg = (void __user *)__arg;
>  	struct trt *trts;
>  	struct art *arts;
>  
>  	switch (cmd) {
>  	case ACPI_THERMAL_GET_TRT_COUNT:
> -		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
>  				&trts, false);
>  		kfree(trts);
>  		if (!ret)
>  			return put_user(count, (unsigned long __user *)__arg);
>  		return ret;
>  	case ACPI_THERMAL_GET_TRT_LEN:
> -		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
>  				&trts, false);
>  		kfree(trts);
>  		length = count * sizeof(union trt_object);
> @@ -341,14 +341,14 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
>  	case ACPI_THERMAL_GET_TRT:
>  		return fill_trt(arg);
>  	case ACPI_THERMAL_GET_ART_COUNT:
> -		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
>  				&arts, false);
>  		kfree(arts);
>  		if (!ret)
>  			return put_user(count, (unsigned long __user *)__arg);
>  		return ret;
>  	case ACPI_THERMAL_GET_ART_LEN:
> -		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
>  				&arts, false);
>  		kfree(arts);
>  		length = count * sizeof(union art_object);


To me, this change is reasonable.

Rui, any comments/objections on this fix?

> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Thermal/int340x: avoid unnecessary pointer casting
  2014-11-04 23:53 [PATCH] Thermal/int340x: avoid unnecessary pointer casting Jacob Pan
  2014-11-07 19:06 ` Eduardo Valentin
@ 2014-11-19  8:31 ` Zhang Rui
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang Rui @ 2014-11-19  8:31 UTC (permalink / raw)
  To: Jacob Pan; +Cc: Linux PM, Dan Carpenter, Rafael Wysocki

On Tue, 2014-11-04 at 15:53 -0800, Jacob Pan wrote:
> Avoid pointer casting which may also lead to problems on big endian
> 64 bit systems.
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Jacob Pan <jacob.jun.pan@linux.intel.com>

Patch queued for 3.19.

thanks,
rui
> ---
>  drivers/thermal/int340x_thermal/acpi_thermal_rel.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> index 0d8db80..ac5c405 100644
> --- a/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> +++ b/drivers/thermal/int340x_thermal/acpi_thermal_rel.c
> @@ -317,21 +317,21 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
>  {
>  	int ret = 0;
>  	unsigned long length = 0;
> -	unsigned long count = 0;
> +	int count = 0;
>  	char __user *arg = (void __user *)__arg;
>  	struct trt *trts;
>  	struct art *arts;
>  
>  	switch (cmd) {
>  	case ACPI_THERMAL_GET_TRT_COUNT:
> -		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
>  				&trts, false);
>  		kfree(trts);
>  		if (!ret)
>  			return put_user(count, (unsigned long __user *)__arg);
>  		return ret;
>  	case ACPI_THERMAL_GET_TRT_LEN:
> -		ret = acpi_parse_trt(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_trt(acpi_thermal_rel_handle, &count,
>  				&trts, false);
>  		kfree(trts);
>  		length = count * sizeof(union trt_object);
> @@ -341,14 +341,14 @@ static long acpi_thermal_rel_ioctl(struct file *f, unsigned int cmd,
>  	case ACPI_THERMAL_GET_TRT:
>  		return fill_trt(arg);
>  	case ACPI_THERMAL_GET_ART_COUNT:
> -		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
>  				&arts, false);
>  		kfree(arts);
>  		if (!ret)
>  			return put_user(count, (unsigned long __user *)__arg);
>  		return ret;
>  	case ACPI_THERMAL_GET_ART_LEN:
> -		ret = acpi_parse_art(acpi_thermal_rel_handle, (int *)&count,
> +		ret = acpi_parse_art(acpi_thermal_rel_handle, &count,
>  				&arts, false);
>  		kfree(arts);
>  		length = count * sizeof(union art_object);



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-19  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-04 23:53 [PATCH] Thermal/int340x: avoid unnecessary pointer casting Jacob Pan
2014-11-07 19:06 ` Eduardo Valentin
2014-11-19  8:31 ` Zhang Rui

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).