All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] platform/surface: aggregator: fix a bit test
@ 2021-04-20  8:44 Dan Carpenter
  2021-04-20 10:24 ` Maximilian Luz
  2021-04-20 15:30 ` Hans de Goede
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-04-20  8:44 UTC (permalink / raw)
  To: Maximilian Luz
  Cc: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel,
	kernel-janitors

The "funcs" variable is a u64.  If "func" is more than 31 then the
BIT() shift will wrap instead of testing the high bits.

Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/platform/surface/aggregator/controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
index 00e38284885a..69e86cd599d3 100644
--- a/drivers/platform/surface/aggregator/controller.c
+++ b/drivers/platform/surface/aggregator/controller.c
@@ -1040,7 +1040,7 @@ static int ssam_dsm_load_u32(acpi_handle handle, u64 funcs, u64 func, u32 *ret)
 	union acpi_object *obj;
 	u64 val;
 
-	if (!(funcs & BIT(func)))
+	if (!(funcs & BIT_ULL(func)))
 		return 0; /* Not supported, leave *ret at its default value */
 
 	obj = acpi_evaluate_dsm_typed(handle, &SSAM_SSH_DSM_GUID,
-- 
2.30.2


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

* Re: [PATCH] platform/surface: aggregator: fix a bit test
  2021-04-20  8:44 [PATCH] platform/surface: aggregator: fix a bit test Dan Carpenter
@ 2021-04-20 10:24 ` Maximilian Luz
  2021-04-20 15:30 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Maximilian Luz @ 2021-04-20 10:24 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel,
	kernel-janitors

On 4/20/21 10:44 AM, Dan Carpenter wrote:
> The "funcs" variable is a u64.  If "func" is more than 31 then the
> BIT() shift will wrap instead of testing the high bits.
> 
> Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks!

Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com>

> ---
>   drivers/platform/surface/aggregator/controller.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
> index 00e38284885a..69e86cd599d3 100644
> --- a/drivers/platform/surface/aggregator/controller.c
> +++ b/drivers/platform/surface/aggregator/controller.c
> @@ -1040,7 +1040,7 @@ static int ssam_dsm_load_u32(acpi_handle handle, u64 funcs, u64 func, u32 *ret)
>   	union acpi_object *obj;
>   	u64 val;
>   
> -	if (!(funcs & BIT(func)))
> +	if (!(funcs & BIT_ULL(func)))
>   		return 0; /* Not supported, leave *ret at its default value */
>   
>   	obj = acpi_evaluate_dsm_typed(handle, &SSAM_SSH_DSM_GUID,
> 

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

* Re: [PATCH] platform/surface: aggregator: fix a bit test
  2021-04-20  8:44 [PATCH] platform/surface: aggregator: fix a bit test Dan Carpenter
  2021-04-20 10:24 ` Maximilian Luz
@ 2021-04-20 15:30 ` Hans de Goede
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2021-04-20 15:30 UTC (permalink / raw)
  To: Dan Carpenter, Maximilian Luz
  Cc: Mark Gross, platform-driver-x86, linux-kernel, kernel-janitors

Hi,

On 4/20/21 10:44 AM, Dan Carpenter wrote:
> The "funcs" variable is a u64.  If "func" is more than 31 then the
> BIT() shift will wrap instead of testing the high bits.
> 
> Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem")
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thank you for your patch, I've applied this patch to my review-hans 
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.

Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.

Regards,

Hans


> ---
>  drivers/platform/surface/aggregator/controller.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c
> index 00e38284885a..69e86cd599d3 100644
> --- a/drivers/platform/surface/aggregator/controller.c
> +++ b/drivers/platform/surface/aggregator/controller.c
> @@ -1040,7 +1040,7 @@ static int ssam_dsm_load_u32(acpi_handle handle, u64 funcs, u64 func, u32 *ret)
>  	union acpi_object *obj;
>  	u64 val;
>  
> -	if (!(funcs & BIT(func)))
> +	if (!(funcs & BIT_ULL(func)))
>  		return 0; /* Not supported, leave *ret at its default value */
>  
>  	obj = acpi_evaluate_dsm_typed(handle, &SSAM_SSH_DSM_GUID,
> 


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

end of thread, other threads:[~2021-04-20 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20  8:44 [PATCH] platform/surface: aggregator: fix a bit test Dan Carpenter
2021-04-20 10:24 ` Maximilian Luz
2021-04-20 15:30 ` Hans de Goede

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.