linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] posix-timers: Remove the stack variable clockid_t introduced as part of Protect posix clock array access against speculation
       [not found] <CGME20180801055857epcas5p35ac85b8c9c9339eb3080e6d89b1a0ce6@epcas5p3.samsung.com>
@ 2018-08-01  5:54 ` Aashish Lakhwara
  2018-08-01 19:50   ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Aashish Lakhwara @ 2018-08-01  5:54 UTC (permalink / raw)
  To: tglx, linux-kernel
  Cc: himanshu.sh, a.sahrawat, pankaj.m, Aashish Lakhwara, Himanshu Shukla

The "array_index_mask_nospec" code has been updated to allow index
argument to have const-qualified type.
Now the stack variable "idx" is no longer required and can be removed.
We should directly pass the const variable "id" to array_index_mask_nospec

Signed-off-by: Aashish Lakhwara <aashish.l@samsung.com>
Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>
---
 kernel/time/posix-timers.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index e08ce3f..face369 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -1357,8 +1357,6 @@ static int common_nsleep(const clockid_t which_clock, int flags,
 
 static const struct k_clock *clockid_to_kclock(const clockid_t id)
 {
-	clockid_t idx = id;
-
 	if (id < 0) {
 		return (id & CLOCKFD_MASK) == CLOCKFD ?
 			&clock_posix_dynamic : &clock_posix_cpu;
@@ -1367,5 +1365,5 @@ static const struct k_clock *clockid_to_kclock(const clockid_t id)
 	if (id >= ARRAY_SIZE(posix_clocks))
 		return NULL;
 
-	return posix_clocks[array_index_nospec(idx, ARRAY_SIZE(posix_clocks))];
+	return posix_clocks[array_index_nospec(id, ARRAY_SIZE(posix_clocks))];
 }
-- 
1.9.1


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

* Re: [PATCH] posix-timers: Remove the stack variable clockid_t introduced as part of Protect posix clock array access against speculation
  2018-08-01  5:54 ` [PATCH] posix-timers: Remove the stack variable clockid_t introduced as part of Protect posix clock array access against speculation Aashish Lakhwara
@ 2018-08-01 19:50   ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2018-08-01 19:50 UTC (permalink / raw)
  To: Aashish Lakhwara
  Cc: linux-kernel, himanshu.sh, a.sahrawat, pankaj.m, Himanshu Shukla

On Wed, 1 Aug 2018, Aashish Lakhwara wrote:

> Subject: [PATCH] posix-timers: Remove the stack variable clockid_t introduced as part of
    Protect posix clock array access against speculation

Documentation/process/submitting-patches.rst:

  For these reasons, the ``summary`` must be no more than 70-75
  characters, and it must describe both what the patch changes, as well
  as why the patch might be necessary.  It is challenging to be both
  succinct and descriptive, but that is what a well-written summary
  should do.

The above $subject violates all of these rules.

> The "array_index_mask_nospec" code has been updated to allow index
> argument to have const-qualified type.

> Now the stack variable "idx" is no longer required and can be removed.
> We should directly pass the const variable "id" to array_index_mask_nospec

We should? Changelogs are about facts. So having:

  The "array_index_mask_nospec" code has been updated to allow index
  argument to have const-qualified type.

  So the stack variable "idx" which was introduced in commit 19b558db12f9
  ("posix-timers: Protect posix clock array access against speculation") to
  cast the const argument 'id' is not longer required.

is factual and precise. Hmm?

> Signed-off-by: Aashish Lakhwara <aashish.l@samsung.com>
> Signed-off-by: Himanshu Shukla <himanshu.sh@samsung.com>

This SOB chain is wrong. Please read and follow the Docuentation.

Thanks,

	tglx

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

end of thread, other threads:[~2018-08-01 19:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180801055857epcas5p35ac85b8c9c9339eb3080e6d89b1a0ce6@epcas5p3.samsung.com>
2018-08-01  5:54 ` [PATCH] posix-timers: Remove the stack variable clockid_t introduced as part of Protect posix clock array access against speculation Aashish Lakhwara
2018-08-01 19:50   ` Thomas Gleixner

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