All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro
@ 2022-06-10 17:27 Risheng1128
  2022-06-22 10:02 ` Hans de Goede
  2022-09-14 18:49 ` srinivas pandruvada
  0 siblings, 2 replies; 3+ messages in thread
From: Risheng1128 @ 2022-06-10 17:27 UTC (permalink / raw)
  To: srinivas.pandruvada; +Cc: platform-driver-x86, linux-kernel, Risheng1128

There are some macros such as `GENMASK` and `GENMASK_ULL` are redefined in
`include/linux/bits.h`. Simultaneously, the `GENMASK` in
`include/linux/bits.h` is more secure and prevents the following situation.
1. [net: stmmac: Fix misuses of GENMASK macro](https://reurl.cc/loMWvl)
2. [clocksource/drivers/npcm: Fix misuse of GENMASK macro](
https://reurl.cc/b2yr96)

Therefore, I think these macro could be removed.

Signed-off-by: Risheng1128 <hi4u29ck02@gmail.com>
---
 tools/power/x86/intel-speed-select/Makefile | 1 +
 tools/power/x86/intel-speed-select/isst.h   | 7 +------
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/tools/power/x86/intel-speed-select/Makefile b/tools/power/x86/intel-speed-select/Makefile
index 7221f2f55e8b..760d49d61955 100644
--- a/tools/power/x86/intel-speed-select/Makefile
+++ b/tools/power/x86/intel-speed-select/Makefile
@@ -14,6 +14,7 @@ endif
 # (this improves performance and avoids hard-to-debug behaviour);
 MAKEFLAGS += -r
 override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -I/usr/include/libnl3
+override CFLAGS += -I../../../include
 override LDFLAGS += -lnl-genl-3 -lnl-3
 
 ALL_TARGETS := intel-speed-select
diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
index 0796d8c6a882..44de990d182e 100644
--- a/tools/power/x86/intel-speed-select/isst.h
+++ b/tools/power/x86/intel-speed-select/isst.h
@@ -27,12 +27,7 @@
 
 #include <stdarg.h>
 #include <sys/ioctl.h>
-
-#define BIT(x) (1 << (x))
-#define BIT_ULL(nr) (1ULL << (nr))
-#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))
-#define GENMASK_ULL(h, l)                                                      \
-	(((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))
+#include <linux/bits.h>
 
 #define CONFIG_TDP				0x7f
 #define CONFIG_TDP_GET_LEVELS_INFO		0x00
-- 
2.25.1


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

* Re: [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro
  2022-06-10 17:27 [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro Risheng1128
@ 2022-06-22 10:02 ` Hans de Goede
  2022-09-14 18:49 ` srinivas pandruvada
  1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-06-22 10:02 UTC (permalink / raw)
  To: Risheng1128, srinivas.pandruvada; +Cc: platform-driver-x86, linux-kernel

Hi all,

Srinivas, I assume that you will review and pick this one up?

Regards,

Hans

On 6/10/22 19:27, Risheng1128 wrote:
> There are some macros such as `GENMASK` and `GENMASK_ULL` are redefined in
> `include/linux/bits.h`. Simultaneously, the `GENMASK` in
> `include/linux/bits.h` is more secure and prevents the following situation.
> 1. [net: stmmac: Fix misuses of GENMASK macro](https://reurl.cc/loMWvl)
> 2. [clocksource/drivers/npcm: Fix misuse of GENMASK macro](
> https://reurl.cc/b2yr96)
> 
> Therefore, I think these macro could be removed.
> 
> Signed-off-by: Risheng1128 <hi4u29ck02@gmail.com>
> ---
>  tools/power/x86/intel-speed-select/Makefile | 1 +
>  tools/power/x86/intel-speed-select/isst.h   | 7 +------
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/power/x86/intel-speed-select/Makefile b/tools/power/x86/intel-speed-select/Makefile
> index 7221f2f55e8b..760d49d61955 100644
> --- a/tools/power/x86/intel-speed-select/Makefile
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -14,6 +14,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -I/usr/include/libnl3
> +override CFLAGS += -I../../../include
>  override LDFLAGS += -lnl-genl-3 -lnl-3
>  
>  ALL_TARGETS := intel-speed-select
> diff --git a/tools/power/x86/intel-speed-select/isst.h b/tools/power/x86/intel-speed-select/isst.h
> index 0796d8c6a882..44de990d182e 100644
> --- a/tools/power/x86/intel-speed-select/isst.h
> +++ b/tools/power/x86/intel-speed-select/isst.h
> @@ -27,12 +27,7 @@
>  
>  #include <stdarg.h>
>  #include <sys/ioctl.h>
> -
> -#define BIT(x) (1 << (x))
> -#define BIT_ULL(nr) (1ULL << (nr))
> -#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8 - 1 - (h))))
> -#define GENMASK_ULL(h, l)                                                      \
> -	(((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 - (h))))
> +#include <linux/bits.h>
>  
>  #define CONFIG_TDP				0x7f
>  #define CONFIG_TDP_GET_LEVELS_INFO		0x00


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

* Re: [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro
  2022-06-10 17:27 [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro Risheng1128
  2022-06-22 10:02 ` Hans de Goede
@ 2022-09-14 18:49 ` srinivas pandruvada
  1 sibling, 0 replies; 3+ messages in thread
From: srinivas pandruvada @ 2022-09-14 18:49 UTC (permalink / raw)
  To: Risheng1128; +Cc: platform-driver-x86, linux-kernel

On Sat, 2022-06-11 at 01:27 +0800, Risheng1128 wrote:
> There are some macros such as `GENMASK` and `GENMASK_ULL` are
> redefined in
> `include/linux/bits.h`. Simultaneously, the `GENMASK` in
> `include/linux/bits.h` is more secure and prevents the following
> situation.
> 1. [net: stmmac: Fix misuses of GENMASK
> macro](https://reurl.cc/loMWvl)
> 2. [clocksource/drivers/npcm: Fix misuse of GENMASK macro](
> https://reurl.cc/b2yr96)
> 
> Therefore, I think these macro could be removed.
> 
Sorry missed this one.

> Signed-off-by: Risheng1128 <hi4u29ck02@gmail.com>
Please follow
https://www.kernel.org/doc/html/v4.17/process/submitting-patches.html
Developer’s Certificate of Origin 1.1

It says

"using your real name (sorry, no pseudonyms or anonymous
contributions.)"

Thanks,
Srinivas




> ---
>  tools/power/x86/intel-speed-select/Makefile | 1 +
>  tools/power/x86/intel-speed-select/isst.h   | 7 +------
>  2 files changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/power/x86/intel-speed-select/Makefile
> b/tools/power/x86/intel-speed-select/Makefile
> index 7221f2f55e8b..760d49d61955 100644
> --- a/tools/power/x86/intel-speed-select/Makefile
> +++ b/tools/power/x86/intel-speed-select/Makefile
> @@ -14,6 +14,7 @@ endif
>  # (this improves performance and avoids hard-to-debug behaviour);
>  MAKEFLAGS += -r
>  override CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include -
> I/usr/include/libnl3
> +override CFLAGS += -I../../../include
>  override LDFLAGS += -lnl-genl-3 -lnl-3
>  
>  ALL_TARGETS := intel-speed-select
> diff --git a/tools/power/x86/intel-speed-select/isst.h
> b/tools/power/x86/intel-speed-select/isst.h
> index 0796d8c6a882..44de990d182e 100644
> --- a/tools/power/x86/intel-speed-select/isst.h
> +++ b/tools/power/x86/intel-speed-select/isst.h
> @@ -27,12 +27,7 @@
>  
>  #include <stdarg.h>
>  #include <sys/ioctl.h>
> -
> -#define BIT(x) (1 << (x))
> -#define BIT_ULL(nr) (1ULL << (nr))
> -#define GENMASK(h, l) (((~0UL) << (l)) & (~0UL >> (sizeof(long) * 8
> - 1 - (h))))
> -#define GENMASK_ULL(h,
> l)                                                      \
> -       (((~0ULL) << (l)) & (~0ULL >> (sizeof(long long) * 8 - 1 -
> (h))))
> +#include <linux/bits.h>
>  
>  #define CONFIG_TDP                             0x7f
>  #define CONFIG_TDP_GET_LEVELS_INFO             0x00


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

end of thread, other threads:[~2022-09-14 18:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 17:27 [PATCH] tools/power/x86/intel-speed-select: Remove duplicate macro Risheng1128
2022-06-22 10:02 ` Hans de Goede
2022-09-14 18:49 ` srinivas pandruvada

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.