linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] misc: sgi-gru: Don't cast parameter in bit operations
@ 2022-02-14 15:39 Andy Shevchenko
  2022-02-14 15:57 ` Dimitri Sivanich
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-02-14 15:39 UTC (permalink / raw)
  To: Xiyu Yang, Andy Shevchenko, linux-kernel
  Cc: Dimitri Sivanich, Arnd Bergmann, Greg Kroah-Hartman

While in this particular case (*) it would not be an issue,
the pattern itself is bad and error prone in case somebody
blindly copies to their code.

Don't cast parameter to unsigned long pointer in the bit
operations. Note, new compilers might warn on this line for
potential outbound access.

*) it seems a dead code, so remove it all for good

Fixes: 13d19498b044 ("GRU Driver: driver internal header files")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/misc/sgi-gru/grutables.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
index e4c067c61251..5efc869fe59a 100644
--- a/drivers/misc/sgi-gru/grutables.h
+++ b/drivers/misc/sgi-gru/grutables.h
@@ -530,12 +530,6 @@ struct gru_blade_state {
 		for ((i) = (k)*GRU_CBR_AU_SIZE;				\
 				(i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)
 
-/* Scan each DSR in a DSR bitmap. Note: multiple DSRs in an allocation unit */
-#define for_each_dsr_in_allocation_map(i, map, k)			\
-	for_each_set_bit((k), (const unsigned long *)(map), GRU_DSR_AU)	\
-		for ((i) = (k) * GRU_DSR_AU_CL;				\
-				(i) < ((k) + 1) * GRU_DSR_AU_CL; (i)++)
-
 #define gseg_physical_address(gru, ctxnum)				\
 		((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
 #define gseg_virtual_address(gru, ctxnum)				\
-- 
2.34.1


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

* Re: [PATCH v1 1/1] misc: sgi-gru: Don't cast parameter in bit operations
  2022-02-14 15:39 [PATCH v1 1/1] misc: sgi-gru: Don't cast parameter in bit operations Andy Shevchenko
@ 2022-02-14 15:57 ` Dimitri Sivanich
  0 siblings, 0 replies; 2+ messages in thread
From: Dimitri Sivanich @ 2022-02-14 15:57 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Xiyu Yang, linux-kernel, Dimitri Sivanich, Arnd Bergmann,
	Greg Kroah-Hartman

Acked-by: Dimitri Sivanich <sivanich@hpe.com>

On Mon, Feb 14, 2022 at 05:39:58PM +0200, Andy Shevchenko wrote:
> While in this particular case (*) it would not be an issue,
> the pattern itself is bad and error prone in case somebody
> blindly copies to their code.
> 
> Don't cast parameter to unsigned long pointer in the bit
> operations. Note, new compilers might warn on this line for
> potential outbound access.
> 
> *) it seems a dead code, so remove it all for good
> 
> Fixes: 13d19498b044 ("GRU Driver: driver internal header files")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/misc/sgi-gru/grutables.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/misc/sgi-gru/grutables.h b/drivers/misc/sgi-gru/grutables.h
> index e4c067c61251..5efc869fe59a 100644
> --- a/drivers/misc/sgi-gru/grutables.h
> +++ b/drivers/misc/sgi-gru/grutables.h
> @@ -530,12 +530,6 @@ struct gru_blade_state {
>  		for ((i) = (k)*GRU_CBR_AU_SIZE;				\
>  				(i) < ((k) + 1) * GRU_CBR_AU_SIZE; (i)++)
>  
> -/* Scan each DSR in a DSR bitmap. Note: multiple DSRs in an allocation unit */
> -#define for_each_dsr_in_allocation_map(i, map, k)			\
> -	for_each_set_bit((k), (const unsigned long *)(map), GRU_DSR_AU)	\
> -		for ((i) = (k) * GRU_DSR_AU_CL;				\
> -				(i) < ((k) + 1) * GRU_DSR_AU_CL; (i)++)
> -
>  #define gseg_physical_address(gru, ctxnum)				\
>  		((gru)->gs_gru_base_paddr + ctxnum * GRU_GSEG_STRIDE)
>  #define gseg_virtual_address(gru, ctxnum)				\
> -- 
> 2.34.1

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

end of thread, other threads:[~2022-02-14 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 15:39 [PATCH v1 1/1] misc: sgi-gru: Don't cast parameter in bit operations Andy Shevchenko
2022-02-14 15:57 ` Dimitri Sivanich

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