Three trivial patchs
cover Three trivial patchs
Patch1: For g_autofree type initialized.
Patch2: Juest 80-char limit for virtio-crypto.
Patch3: Redundant type conversion for crypto.
Chen Qun (3):
gdbstub: prevent uninitialized warning
virtio-crypto: fix 80-char limit violations in
virtio_crypto_device_realize()
crypto: Redundant type conversion for AES_KEY pointer
crypto/cipher-builtin.c | 6 ++---- gdbstub.c | 4 ++-- hw/virtio/virtio-crypto.c | 3 ++- 3 files changed, 6 insertions(+), 7 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/3 gdbstub: prevent uninitialized warning
According to the glib function requirements, we need initialise
the variable. Otherwise there will be compilation warnings:
qemu/gdbstub.c: In function ‘handle_query_thread_extra’:/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning:
‘cpu_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]
g_free (*pp);
^~~~~~~~~~~~
---
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>
--- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
gdbstub.c +2 -2
@@ -2060,8 +2060,8 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)/* Print the CPU model and name in multiprocess mode */ ObjectClass *oc =object_get_class (OBJECT (cpu));const char *cpu_model =object_class_get_name (oc); - g_autofree char *cpu_name; - cpu_name =object_get_canonical_path_component (OBJECT (cpu)); + g_autofree char *cpu_name = +object_get_canonical_path_component (OBJECT (cpu));g_string_printf (rs,"%s %s [%s]" , cpu_model, cpu_name, cpu->halted ?"halted " :"running" ); }else {
Signature · 1 line
2.23.0
Re: [PATCH 1/3] gdbstub: prevent uninitialized warning
Quoted 38 lines · Chen Qun
According to the glib function requirements, we need initialise
the variable. Otherwise there will be compilation warnings:
qemu/gdbstub.c: In function ‘handle_query_thread_extra’:/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning:
‘cpu_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]g_free (*pp); ^~~~~~~~~~~~Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>--- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)gdbstub.c +2
-2@@ -2060,8 +2060,8 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)/* Print the CPU model and name in multiprocess mode */ ObjectClass *oc =object_get_class (OBJECT (cpu));const char *cpu_model =object_class_get_name (oc); - g_autofree char *cpu_name; - cpu_name =object_get_canonical_path_component (OBJECT (cpu)); + g_autofree char *cpu_name = +object_get_canonical_path_component (OBJECT (cpu));g_string_printf (rs,"%s %s [%s]" , cpu_model, cpu_name, cpu->halted ?"halted " :"running" ); }else {Signature · 1 line
2.23.0
Fixing broken build with -Wall.
Re: [PATCH 1/3] gdbstub: prevent uninitialized warning
In reply to Chen QunQuoted 11 lines · Chen Qun
According to the glib function requirements, we need initialise
the variable. Otherwise there will be compilation warnings:
qemu/gdbstub.c: In function ‘handle_query_thread_extra’:/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning:
‘cpu_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]g_free (*pp); ^~~~~~~~~~~~Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>
Thanks,
I've pulled in a duplicate fix from:
Message-Id: <[email protected]>
and added your Reported-by's
Quoted 22 lines
---
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>--- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)gdbstub.c +2
-2@@ -2060,8 +2060,8 @@ static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)/* Print the CPU model and name in multiprocess mode */ ObjectClass *oc =object_get_class (OBJECT (cpu));const char *cpu_model =object_class_get_name (oc); - g_autofree char *cpu_name; - cpu_name =object_get_canonical_path_component (OBJECT (cpu)); + g_autofree char *cpu_name = +object_get_canonical_path_component (OBJECT (cpu));g_string_printf (rs,"%s %s [%s]" , cpu_model, cpu_name, cpu->halted ?"halted " :"running" ); }else {
Signature · 1 line
Alex Bennée
RE: [PATCH 1/3] gdbstub: prevent uninitialized warning
Quoted 24 lines
-----Original Message-----
From: Alex Bennée [mailto:[email protected]]
Sent: Friday, March 27, 2020 5:13 PM
To: Chenqun (kuhn) <[email protected]>
Cc: [email protected]; [email protected]; Zhanghailiang <[email protected]>; [email protected]; Euler Robot <[email protected]>; Philippe Mathieu-Daudé <[email protected]>
Subject: Re: [PATCH 1/3] gdbstub: prevent uninitialized warningQuoted 11 lines · Chen Qun
According to the glib function requirements, we need initialise
the variable. Otherwise there will be compilation warnings:
qemu/gdbstub.c: In function ‘handle_query_thread_extra’:/usr/include/glib-2.0/glib/glib-autocleanups.h:28:3: warning:
‘cpu_name’ may be used uninitialized in this function [-Wmaybe-uninitialized]g_free (*pp); ^~~~~~~~~~~~Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>
Quoted 7 lines
Thanks,
I've pulled in a duplicate fix from:
Message-Id: <[email protected]>
and added your Reported-by's
OK, If possible, bring Miroslav Rezanina's "Reviewed-by" tag.
https://lists.gnu.org/archive/html/qemu-devel/2020-03/msg07651.html
Thanks.
Quoted 28 lines
gdbstub.c static void
Quoted 13 lines
---
Cc: "Alex Bennée" <[email protected]>
Cc: "Philippe Mathieu-Daudé" <[email protected]>--- gdbstub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)gdbstub.c +0
-0@@ -2060,8 +2060,8 @@ static void
handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx)gdbstub.c static void handle_query_thread_extra(GdbCmdContext *gdb_ctx, void *user_ctx) · line 2067
Quoted 10 lines
gdbstub.c +2
-2/* Print the CPU model and name in multiprocess mode */ ObjectClass *oc =object_get_class (OBJECT (cpu));const char *cpu_model =object_class_get_name (oc); - g_autofree char *cpu_name; - cpu_name =object_get_canonical_path_component (OBJECT (cpu)); + g_autofree char *cpu_name = +object_get_canonical_path_component (OBJECT (cpu));g_string_printf (rs,"%s %s [%s]" , cpu_model, cpu_name, cpu->halted ?"halted " :"running" ); }else {--
Alex Bennée
PATCH 2/3 virtio-crypto: fix 80-char limit violations in virtio_crypto_device_realize()
In reply to Chen QunFix: aa8f057e74ae
--- hw/virtio/virtio-crypto.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/virtio/virtio-crypto.c +2 -1
@@ -786,7 +786,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)error_setg (errp,"'cryptodev' parameter expects a valid object" );return ; }else if (cryptodev_backend_is_used (vcrypto->cryptodev)) { -char *path =object_get_canonical_path_component (OBJECT (vcrypto->conf.cryptodev)); +char *path =object_get_canonical_path_component ( +OBJECT (vcrypto->conf.cryptodev));error_setg (errp,"can't use already used cryptodev backend: %s" , path);g_free (path);return ;
Signature · 1 line
2.23.0
PATCH 3/3 crypto: Redundant type conversion for AES_KEY pointer
In reply to Chen QunFix: eaec903c5b8
---
Cc: "Daniel P. Berrangé" <[email protected]>
--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
crypto/cipher-builtin.c +2 -4
@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }
@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }
Signature · 1 line
2.23.0
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 25/03/2020 à 10:21, Chen Qun a écrit :
Quoted 2 lines
Fix:
eaec903c5b8
Did you run the coccinelle script scripts/coccinelle/typecast.cocci ?
Thanks,
Laurent
Quoted 33 lines
Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)crypto/cipher-builtin.c +2
-4@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }
RE: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Quoted 9 lines
-----Original Message-----
From: Laurent Vivier [mailto:[email protected]]
Sent: Wednesday, March 25, 2020 5:45 PM
To: Chenqun (kuhn) <[email protected]>; [email protected]; [email protected]
Cc: Zhanghailiang <[email protected]>; Euler Robot <[email protected]>; Daniel P. Berrangé <[email protected]>
Subject: Re: [PATCH 3/3] crypto: Redundant type conversion forAES_KEYpointer
Quoted 6 lines
Le 25/03/2020 à 10:21, Chen Qun a écrit :
Quoted 2 lines
Fix:
eaec903c5b8Did you run the coccinelle script
scripts/coccinelle/typecast.cocci?
Yes, I run it and plan to integrate it into EulerRobot so that similar issues can be discovered sooner.
Thanks.
Quoted 34 lines
Quoted 34 lines
Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)crypto/cipher-builtin.c index renamed from crypto/cipher-builtin.c +0
-0
bf8413e71a..99d6280a16100644crypto/cipher-builtin.c +2
-4@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }
Laurent Vivier
Reviewed-byRe: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 25/03/2020 à 11:06, Chenqun (kuhn) a écrit :
Quoted 45 lines
Quoted 9 lines
-----Original Message-----
From: Laurent Vivier [mailto:[email protected]]
Sent: Wednesday, March 25, 2020 5:45 PM
To: Chenqun (kuhn) <[email protected]>; [email protected]; [email protected]
Cc: Zhanghailiang <[email protected]>; Euler Robot <[email protected]>; Daniel P. Berrangé <[email protected]>
Subject: Re: [PATCH 3/3] crypto: Redundant type conversion forAES_KEYpointerQuoted 6 lines
Le 25/03/2020 à 10:21, Chen Qun a écrit :
Quoted 2 lines
Fix:
eaec903c5b8Did you run the coccinelle script
scripts/coccinelle/typecast.cocci?Yes, I run it and plan to integrate it into EulerRobot so that similar issues can be discovered sooner.
Thanks.
Quoted 27 lines
Quoted 27 lines
Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)crypto/cipher-builtin.c index renamed from crypto/cipher-builtin.c +0
-0
bf8413e71a..99d6280a16100644crypto/cipher-builtin.c +1
-2@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx;
Quoted 8 lines
Quoted 7 lines
crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, · line 150
Quoted 7 lines
crypto/cipher-builtin.c +1
-2-qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
In reply to Chen QunQuoted 9 lines · Chen Qun
Fix:
eaec903c5b8Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 29 lines
crypto/cipher-builtin.c +2
-4@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }Signature · 1 line
2.23.0
Regards,
Daniel
Signature · 3 lines
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Laurent Vivier
AppliedRe: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
In reply to Chen QunLe 25/03/2020 à 10:21, Chen Qun a écrit :
Quoted 26 lines
Fix:
eaec903c5b8Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)crypto/cipher-builtin.c +1
-2@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }
crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, · line 150
Quoted 9 lines
crypto/cipher-builtin.c +1
-2@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }
Applied to my trivial-patches-for-5.1 branch.
Thanks,
Laurent
Re: [PATCH 3/3] crypto: Redundant type conversion for AES_KEY pointer
Le 03/04/2020 à 10:47, Laurent Vivier a écrit :
Quoted 29 lines
Le 25/03/2020 à 10:21, Chen Qun a écrit :
Quoted 28 lines
Fix:
eaec903c5b8Reported-by Euler Robot <[email protected]>Signed-off-by Chen Qun <[email protected]>---
Cc: "Daniel P. Berrangé" <[email protected]>--- crypto/cipher-builtin.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)crypto/cipher-builtin.c +1
-2@@ -133,8 +133,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx; -qcrypto_cipher_aes_ecb_encrypt ((AES_KEY *)&aesctx->enc, - src, dst, length); +qcrypto_cipher_aes_ecb_encrypt (&aesctx->enc, src, dst, length); }@@ -145,8 +144,7 @@ static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, {const QCryptoCipherBuiltinAESContext *aesctx = ctx;
Quoted 9 lines
crypto/cipher-builtin.c static void qcrypto_cipher_aes_xts_decrypt(const void *ctx, · line 150
Quoted 7 lines
crypto/cipher-builtin.c +1
-2-qcrypto_cipher_aes_ecb_decrypt ((AES_KEY *)&aesctx->dec, - src, dst, length); +qcrypto_cipher_aes_ecb_decrypt (&aesctx->dec, src, dst, length); }Applied to my trivial-patches-for-5.1 branch.
Removed from the queue because of build errors:
https://travis-ci.com/github/vivier/qemu/jobs/327261040
In file included from /home/travis/build/vivier/qemu/crypto/cipher.c:157:0:1251/home/travis/build/vivier/qemu/crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_encrypt’:1252/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:136:36:
error: passing argument 1 of ‘qcrypto_cipher_aes_ecb_encrypt’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
1253 qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc, src, dst, length);
1254 ^1255/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:77:13: note:
expected ‘AES_KEY * {aka struct aes_key_st *}’ but argument is of type ‘const AES_KEY * {aka const struct aes_key_st *}’
1256 static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
1257 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~1258/home/travis/build/vivier/qemu/crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_decrypt’:1259/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:147:36:
error: passing argument 1 of ‘qcrypto_cipher_aes_ecb_decrypt’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
1260 qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec, src, dst, length);
1261 ^1262/home/travis/build/vivier/qemu/crypto/cipher-builtin.c:103:13: note:
expected ‘AES_KEY * {aka struct aes_key_st *}’ but argument is of type ‘const AES_KEY * {aka const struct aes_key_st *}’
1263 static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
1264 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1265cc1: all warnings being treated as errors 1266/home/travis/build/vivier/qemu/rules.mak:69: recipe for target 'crypto/cipher.o' failed
1267make: *** [crypto/cipher.o] Error 1
1268make: *** Waiting for unfinished jobs....