qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] remove some variable shadowing
@ 2023-09-22 16:06 Daniel P. Berrangé
  2023-09-22 16:06 ` [PATCH 1/2] crypto: remove shadowed 'ret' variable Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2023-09-22 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé, Markus Armbruster



Daniel P. Berrangé (2):
  crypto: remove shadowed 'ret' variable
  seccomp: avoid shadowing of 'action' variable

 crypto/tls-cipher-suites.c | 1 -
 softmmu/qemu-seccomp.c     | 4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

-- 
2.41.0



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

* [PATCH 1/2] crypto: remove shadowed 'ret' variable
  2023-09-22 16:06 [PATCH 0/2] remove some variable shadowing Daniel P. Berrangé
@ 2023-09-22 16:06 ` Daniel P. Berrangé
  2023-09-22 18:15   ` Philippe Mathieu-Daudé
  2023-09-22 16:06 ` [PATCH 2/2] seccomp: avoid shadowing of 'action' variable Daniel P. Berrangé
  2023-09-29  6:49 ` [PATCH 0/2] remove some variable shadowing Markus Armbruster
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrangé @ 2023-09-22 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé, Markus Armbruster

Both instances of 'ret' are used to store a gnutls API return code.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 crypto/tls-cipher-suites.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/crypto/tls-cipher-suites.c b/crypto/tls-cipher-suites.c
index 5e4f597464..d0df4badc0 100644
--- a/crypto/tls-cipher-suites.c
+++ b/crypto/tls-cipher-suites.c
@@ -52,7 +52,6 @@ GByteArray *qcrypto_tls_cipher_suites_get_data(QCryptoTLSCipherSuites *obj,
     byte_array = g_byte_array_new();
 
     for (i = 0;; i++) {
-        int ret;
         unsigned idx;
         const char *name;
         IANA_TLS_CIPHER cipher;
-- 
2.41.0



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

* [PATCH 2/2] seccomp: avoid shadowing of 'action' variable
  2023-09-22 16:06 [PATCH 0/2] remove some variable shadowing Daniel P. Berrangé
  2023-09-22 16:06 ` [PATCH 1/2] crypto: remove shadowed 'ret' variable Daniel P. Berrangé
@ 2023-09-22 16:06 ` Daniel P. Berrangé
  2023-09-29  6:49   ` Markus Armbruster
  2023-09-29  6:49 ` [PATCH 0/2] remove some variable shadowing Markus Armbruster
  2 siblings, 1 reply; 6+ messages in thread
From: Daniel P. Berrangé @ 2023-09-22 16:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrangé, Markus Armbruster

This is confusing as one 'action' variable is used for storing
a SCMP_ enum value, while the other 'action' variable is used
for storing a SECCOMP_ enum value.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 softmmu/qemu-seccomp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c
index d66a2a1226..4d7439e7f7 100644
--- a/softmmu/qemu-seccomp.c
+++ b/softmmu/qemu-seccomp.c
@@ -283,9 +283,9 @@ static uint32_t qemu_seccomp_update_action(uint32_t action)
     if (action == SCMP_ACT_TRAP) {
         static int kill_process = -1;
         if (kill_process == -1) {
-            uint32_t action = SECCOMP_RET_KILL_PROCESS;
+            uint32_t testaction = SECCOMP_RET_KILL_PROCESS;
 
-            if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &action) == 0) {
+            if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &testaction) == 0) {
                 kill_process = 1;
             } else {
                 kill_process = 0;
-- 
2.41.0



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

* Re: [PATCH 1/2] crypto: remove shadowed 'ret' variable
  2023-09-22 16:06 ` [PATCH 1/2] crypto: remove shadowed 'ret' variable Daniel P. Berrangé
@ 2023-09-22 18:15   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-09-22 18:15 UTC (permalink / raw)
  To: Daniel P. Berrangé, qemu-devel; +Cc: Markus Armbruster

On 22/9/23 18:06, Daniel P. Berrangé wrote:
> Both instances of 'ret' are used to store a gnutls API return code.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>   crypto/tls-cipher-suites.c | 1 -
>   1 file changed, 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



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

* Re: [PATCH 2/2] seccomp: avoid shadowing of 'action' variable
  2023-09-22 16:06 ` [PATCH 2/2] seccomp: avoid shadowing of 'action' variable Daniel P. Berrangé
@ 2023-09-29  6:49   ` Markus Armbruster
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2023-09-29  6:49 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

Daniel P. Berrangé <berrange@redhat.com> writes:

> This is confusing as one 'action' variable is used for storing
> a SCMP_ enum value, while the other 'action' variable is used
> for storing a SECCOMP_ enum value.
>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  softmmu/qemu-seccomp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/softmmu/qemu-seccomp.c b/softmmu/qemu-seccomp.c
> index d66a2a1226..4d7439e7f7 100644
> --- a/softmmu/qemu-seccomp.c
> +++ b/softmmu/qemu-seccomp.c
> @@ -283,9 +283,9 @@ static uint32_t qemu_seccomp_update_action(uint32_t action)
>      if (action == SCMP_ACT_TRAP) {
>          static int kill_process = -1;
>          if (kill_process == -1) {
> -            uint32_t action = SECCOMP_RET_KILL_PROCESS;
> +            uint32_t testaction = SECCOMP_RET_KILL_PROCESS;
>  
> -            if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &action) == 0) {
> +            if (qemu_seccomp(SECCOMP_GET_ACTION_AVAIL, 0, &testaction) == 0) {
>                  kill_process = 1;
>              } else {
>                  kill_process = 0;

I'd prefer @test_action.  Regardless:
Reviewed-by: Markus Armbruster <armbru@redhat.com>



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

* Re: [PATCH 0/2] remove some variable shadowing
  2023-09-22 16:06 [PATCH 0/2] remove some variable shadowing Daniel P. Berrangé
  2023-09-22 16:06 ` [PATCH 1/2] crypto: remove shadowed 'ret' variable Daniel P. Berrangé
  2023-09-22 16:06 ` [PATCH 2/2] seccomp: avoid shadowing of 'action' variable Daniel P. Berrangé
@ 2023-09-29  6:49 ` Markus Armbruster
  2 siblings, 0 replies; 6+ messages in thread
From: Markus Armbruster @ 2023-09-29  6:49 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel

Queued, thanks!



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

end of thread, other threads:[~2023-09-29  6:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22 16:06 [PATCH 0/2] remove some variable shadowing Daniel P. Berrangé
2023-09-22 16:06 ` [PATCH 1/2] crypto: remove shadowed 'ret' variable Daniel P. Berrangé
2023-09-22 18:15   ` Philippe Mathieu-Daudé
2023-09-22 16:06 ` [PATCH 2/2] seccomp: avoid shadowing of 'action' variable Daniel P. Berrangé
2023-09-29  6:49   ` Markus Armbruster
2023-09-29  6:49 ` [PATCH 0/2] remove some variable shadowing Markus Armbruster

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