* [PATCH] ipc: Remove dead code in perform_atomic_semop()
@ 2022-05-24 18:22 ` Gautam Menghani
0 siblings, 0 replies; 8+ messages in thread
From: Gautam Menghani @ 2022-05-24 18:22 UTC (permalink / raw)
To: akpm, shakeelb, vasily.averin, mhocko, manfred
Cc: Gautam Menghani, linux-kernel, linux-kernel-mentees, skhan
Remove the line which is dead code. Fixes the clang scan warning:
warning: Value stored to 'result' is never read [deadcode.DeadStores]
result = curr->semval;
Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
ipc/sem.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ipc/sem.c b/ipc/sem.c
index 0dbdb98fdf2d..156824bcda47 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
for (sop = sops; sop < sops + nsops; sop++) {
curr = &sma->sems[sop->sem_num];
sem_op = sop->sem_op;
- result = curr->semval;
if (sop->sem_flg & SEM_UNDO) {
int undo = un->semadj[sop->sem_num] - sem_op;
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH] ipc: Remove dead code in perform_atomic_semop()
@ 2022-05-24 18:22 ` Gautam Menghani
0 siblings, 0 replies; 8+ messages in thread
From: Gautam Menghani @ 2022-05-24 18:22 UTC (permalink / raw)
To: akpm, shakeelb, vasily.averin, mhocko, manfred
Cc: linux-kernel-mentees, linux-kernel, Gautam Menghani
Remove the line which is dead code. Fixes the clang scan warning:
warning: Value stored to 'result' is never read [deadcode.DeadStores]
result = curr->semval;
Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
ipc/sem.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/ipc/sem.c b/ipc/sem.c
index 0dbdb98fdf2d..156824bcda47 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
for (sop = sops; sop < sops + nsops; sop++) {
curr = &sma->sems[sop->sem_num];
sem_op = sop->sem_op;
- result = curr->semval;
if (sop->sem_flg & SEM_UNDO) {
int undo = un->semadj[sop->sem_num] - sem_op;
--
2.25.1
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
2022-05-24 18:22 ` Gautam Menghani
@ 2022-05-24 23:12 ` vasily.averin
-1 siblings, 0 replies; 8+ messages in thread
From: vasily.averin @ 2022-05-24 23:12 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, mhocko, manfred
Cc: linux-kernel, linux-kernel-mentees, skhan
On 5/24/22 21:22, Gautam Menghani wrote:
> Remove the line which is dead code. Fixes the clang scan warning:
> warning: Value stored to 'result' is never read [deadcode.DeadStores]
> result = curr->semval;
>
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
> ---
> ipc/sem.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 0dbdb98fdf2d..156824bcda47 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
> for (sop = sops; sop < sops + nsops; sop++) {
> curr = &sma->sems[sop->sem_num];
> sem_op = sop->sem_op;
> - result = curr->semval;
>
> if (sop->sem_flg & SEM_UNDO) {
> int undo = un->semadj[sop->sem_num] - sem_op;
Perhaps it would be better to keep the "result" but use it in the
marked line below, like it was done in previous part of this function?
un->semadj[sop->sem_num] = undo;
}
curr->semval += sem_op; <<<<<< VvS: here ?
ipc_update_pid(&curr->sempid, q->pid);
Thank you,
Vasily Averin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
@ 2022-05-24 23:12 ` vasily.averin
0 siblings, 0 replies; 8+ messages in thread
From: vasily.averin @ 2022-05-24 23:12 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, mhocko, manfred
Cc: linux-kernel-mentees, linux-kernel
On 5/24/22 21:22, Gautam Menghani wrote:
> Remove the line which is dead code. Fixes the clang scan warning:
> warning: Value stored to 'result' is never read [deadcode.DeadStores]
> result = curr->semval;
>
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
> ---
> ipc/sem.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 0dbdb98fdf2d..156824bcda47 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
> for (sop = sops; sop < sops + nsops; sop++) {
> curr = &sma->sems[sop->sem_num];
> sem_op = sop->sem_op;
> - result = curr->semval;
>
> if (sop->sem_flg & SEM_UNDO) {
> int undo = un->semadj[sop->sem_num] - sem_op;
Perhaps it would be better to keep the "result" but use it in the
marked line below, like it was done in previous part of this function?
un->semadj[sop->sem_num] = undo;
}
curr->semval += sem_op; <<<<<< VvS: here ?
ipc_update_pid(&curr->sempid, q->pid);
Thank you,
Vasily Averin
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
2022-05-24 23:12 ` vasily.averin
@ 2022-05-25 4:20 ` Vasily Averin
-1 siblings, 0 replies; 8+ messages in thread
From: Vasily Averin @ 2022-05-25 4:20 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, mhocko, manfred
Cc: linux-kernel, linux-kernel-mentees, skhan
On 5/25/22 02:12, vasily.averin@linux.dev wrote:
> On 5/24/22 21:22, Gautam Menghani wrote:
>> Remove the line which is dead code. Fixes the clang scan warning:
>> warning: Value stored to 'result' is never read [deadcode.DeadStores]
>> result = curr->semval;
>>
>> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
>> ---
>> ipc/sem.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/ipc/sem.c b/ipc/sem.c
>> index 0dbdb98fdf2d..156824bcda47 100644
>> --- a/ipc/sem.c
>> +++ b/ipc/sem.c
>> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
>> for (sop = sops; sop < sops + nsops; sop++) {
>> curr = &sma->sems[sop->sem_num];
>> sem_op = sop->sem_op;
>> - result = curr->semval;
>>
>> if (sop->sem_flg & SEM_UNDO) {
>> int undo = un->semadj[sop->sem_num] - sem_op;
>
> Perhaps it would be better to keep the "result" but use it in the
> marked line below, like it was done in previous part of this function?
Sorry, I was wrong.
Reviewed-by: Vasily Averin <vvs@openvz.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
@ 2022-05-25 4:20 ` Vasily Averin
0 siblings, 0 replies; 8+ messages in thread
From: Vasily Averin @ 2022-05-25 4:20 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, mhocko, manfred
Cc: linux-kernel-mentees, linux-kernel
On 5/25/22 02:12, vasily.averin@linux.dev wrote:
> On 5/24/22 21:22, Gautam Menghani wrote:
>> Remove the line which is dead code. Fixes the clang scan warning:
>> warning: Value stored to 'result' is never read [deadcode.DeadStores]
>> result = curr->semval;
>>
>> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
>> ---
>> ipc/sem.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/ipc/sem.c b/ipc/sem.c
>> index 0dbdb98fdf2d..156824bcda47 100644
>> --- a/ipc/sem.c
>> +++ b/ipc/sem.c
>> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
>> for (sop = sops; sop < sops + nsops; sop++) {
>> curr = &sma->sems[sop->sem_num];
>> sem_op = sop->sem_op;
>> - result = curr->semval;
>>
>> if (sop->sem_flg & SEM_UNDO) {
>> int undo = un->semadj[sop->sem_num] - sem_op;
>
> Perhaps it would be better to keep the "result" but use it in the
> marked line below, like it was done in previous part of this function?
Sorry, I was wrong.
Reviewed-by: Vasily Averin <vvs@openvz.org>
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
2022-05-24 18:22 ` Gautam Menghani
@ 2022-05-25 19:26 ` Manfred Spraul
-1 siblings, 0 replies; 8+ messages in thread
From: Manfred Spraul @ 2022-05-25 19:26 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, vasily.averin, mhocko
Cc: linux-kernel, linux-kernel-mentees, skhan
On 5/24/22 20:22, Gautam Menghani wrote:
> Remove the line which is dead code. Fixes the clang scan warning:
> warning: Value stored to 'result' is never read [deadcode.DeadStores]
> result = curr->semval;
>
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
Reviewed-by: Manfred Spraul <manfred@colorfullife.com>
> ---
> ipc/sem.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 0dbdb98fdf2d..156824bcda47 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
> for (sop = sops; sop < sops + nsops; sop++) {
> curr = &sma->sems[sop->sem_num];
> sem_op = sop->sem_op;
> - result = curr->semval;
>
A copy/paste mistake: The 1st loop in perform_atomic_semop() needs
result - because it must check for overflows.
The 2nd loop doesn't need it.
> if (sop->sem_flg & SEM_UNDO) {
> int undo = un->semadj[sop->sem_num] - sem_op;
--
Manfred
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] ipc: Remove dead code in perform_atomic_semop()
@ 2022-05-25 19:26 ` Manfred Spraul
0 siblings, 0 replies; 8+ messages in thread
From: Manfred Spraul @ 2022-05-25 19:26 UTC (permalink / raw)
To: Gautam Menghani, akpm, shakeelb, vasily.averin, mhocko
Cc: linux-kernel-mentees, linux-kernel
On 5/24/22 20:22, Gautam Menghani wrote:
> Remove the line which is dead code. Fixes the clang scan warning:
> warning: Value stored to 'result' is never read [deadcode.DeadStores]
> result = curr->semval;
>
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
Reviewed-by: Manfred Spraul <manfred@colorfullife.com>
> ---
> ipc/sem.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/ipc/sem.c b/ipc/sem.c
> index 0dbdb98fdf2d..156824bcda47 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -766,7 +766,6 @@ static int perform_atomic_semop(struct sem_array *sma, struct sem_queue *q)
> for (sop = sops; sop < sops + nsops; sop++) {
> curr = &sma->sems[sop->sem_num];
> sem_op = sop->sem_op;
> - result = curr->semval;
>
A copy/paste mistake: The 1st loop in perform_atomic_semop() needs
result - because it must check for overflows.
The 2nd loop doesn't need it.
> if (sop->sem_flg & SEM_UNDO) {
> int undo = un->semadj[sop->sem_num] - sem_op;
--
Manfred
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-05-25 19:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-24 18:22 [PATCH] ipc: Remove dead code in perform_atomic_semop() Gautam Menghani
2022-05-24 18:22 ` Gautam Menghani
2022-05-24 23:12 ` vasily.averin
2022-05-24 23:12 ` vasily.averin
2022-05-25 4:20 ` Vasily Averin
2022-05-25 4:20 ` Vasily Averin
2022-05-25 19:26 ` Manfred Spraul
2022-05-25 19:26 ` Manfred Spraul
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.