* [Qemu-devel] [PATCH 0/7] Remove useless casts
@ 2016-06-15 16:14 Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove " Laurent Vivier
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier
This series is the result of the following coccinelle script:
@@
type T;
T v;
@@
- (T *)&v
+ &v
This script removes the cast of a variable when the variable
is already of the casting type.
The script is added in scripts/coccinelle by the first patch.
Laurent Vivier (7):
coccinelle: add a script to remove useless casts
linux-user,s390x: remove useless cast
s390x: remove useless cast
tricore: remove useless cast
fw_cfg: remove useless casts
crypto: remove useless casts
sheepdog: remove useless casts
block/sheepdog.c | 4 ++--
crypto/cipher-builtin.c | 4 ++--
hw/nvram/fw_cfg.c | 4 ++--
hw/s390x/sclp.c | 2 +-
hw/tricore/tricore_testboard.c | 2 +-
linux-user/signal.c | 2 +-
scripts/coccinelle/typecast.cocci | 7 +++++++
7 files changed, 16 insertions(+), 9 deletions(-)
create mode 100644 scripts/coccinelle/typecast.cocci
--
2.5.5
^ permalink raw reply [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-24 17:21 ` Eric Blake
2016-06-15 16:14 ` [Qemu-devel] [PATCH 2/7] linux-user,s390x: remove useless cast Laurent Vivier
` (7 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier
Script from LKML.
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
scripts/coccinelle/typecast.cocci | 7 +++++++
1 file changed, 7 insertions(+)
create mode 100644 scripts/coccinelle/typecast.cocci
diff --git a/scripts/coccinelle/typecast.cocci b/scripts/coccinelle/typecast.cocci
new file mode 100644
index 0000000..be2183e
--- /dev/null
+++ b/scripts/coccinelle/typecast.cocci
@@ -0,0 +1,7 @@
+// Remove useless casts
+@@
+type T;
+T v;
+@@
+- (T *)&v
++ &v
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 2/7] linux-user,s390x: remove useless cast
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove " Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 3/7] s390x: " Laurent Vivier
` (6 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Riku Voipio, Alexander Graf
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Riku Voipio <riku.voipio@iki.fi>
CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
linux-user/signal.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 61c1145..df3d584 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -4232,7 +4232,7 @@ static void setup_frame(int sig, struct target_sigaction *ka,
env->regs[5] = 0; // FIXME: no clue... current->thread.prot_addr;
/* Place signal number on stack to allow backtrace from handler. */
- __put_user(env->regs[2], (int *) &frame->signo);
+ __put_user(env->regs[2], &frame->signo);
unlock_user_struct(frame, frame_addr, 1);
return;
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 3/7] s390x: remove useless cast
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove " Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 2/7] linux-user,s390x: remove useless cast Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 4/7] tricore: " Laurent Vivier
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Cornelia Huck
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/s390x/sclp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index fca37f5..feeb0da 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -406,7 +406,7 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
goto out;
}
- sclp_c->execute(sclp, (SCCB *)&work_sccb, code);
+ sclp_c->execute(sclp, &work_sccb, code);
cpu_physical_memory_write(sccb, &work_sccb,
be16_to_cpu(work_sccb.h.length));
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 4/7] tricore: remove useless cast
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (2 preceding siblings ...)
2016-06-15 16:14 ` [Qemu-devel] [PATCH 3/7] s390x: " Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-16 8:17 ` Bastian Koppelmann
2016-06-15 16:14 ` [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts Laurent Vivier
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Bastian Koppelmann
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/tricore/tricore_testboard.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/tricore/tricore_testboard.c b/hw/tricore/tricore_testboard.c
index 8d3520f..19dd587 100644
--- a/hw/tricore/tricore_testboard.c
+++ b/hw/tricore/tricore_testboard.c
@@ -46,7 +46,7 @@ static void tricore_load_kernel(CPUTriCoreState *env)
long kernel_size;
kernel_size = load_elf(tricoretb_binfo.kernel_filename, NULL,
- NULL, (uint64_t *)&entry, NULL,
+ NULL, &entry, NULL,
NULL, 0,
EM_TRICORE, 1, 0);
if (kernel_size <= 0) {
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (3 preceding siblings ...)
2016-06-15 16:14 ` [Qemu-devel] [PATCH 4/7] tricore: " Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-15 16:34 ` Laszlo Ersek
2016-06-15 16:14 ` [Qemu-devel] [PATCH 6/7] crypto: " Laurent Vivier
` (3 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Laszlo Ersek
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
hw/nvram/fw_cfg.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 74a0079..9d84129 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -180,7 +180,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)
temp = qemu_opt_get(opts, "splash-time");
if (temp != NULL) {
p = (char *)temp;
- boot_splash_time = strtol(p, (char **)&p, 10);
+ boot_splash_time = strtol(p, &p, 10);
}
}
@@ -240,7 +240,7 @@ static void fw_cfg_reboot(FWCfgState *s)
temp = qemu_opt_get(opts, "reboot-timeout");
if (temp != NULL) {
p = (char *)temp;
- reboot_timeout = strtol(p, (char **)&p, 10);
+ reboot_timeout = strtol(p, &p, 10);
}
}
/* validate the input */
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 6/7] crypto: remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (4 preceding siblings ...)
2016-06-15 16:14 ` [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-23 11:07 ` Daniel P. Berrange
2016-09-14 7:40 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2016-06-15 16:14 ` [Qemu-devel] [PATCH 7/7] sheepdog: " Laurent Vivier
` (2 subsequent siblings)
8 siblings, 2 replies; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Daniel P. Berrange
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
crypto/cipher-builtin.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
index 88963f6..d791c80 100644
--- a/crypto/cipher-builtin.c
+++ b/crypto/cipher-builtin.c
@@ -132,7 +132,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
{
const QCryptoCipherBuiltinAESContext *aesctx = ctx;
- qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
+ qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
src, dst, length);
}
@@ -144,7 +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,
+ qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
src, dst, length);
}
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [Qemu-devel] [PATCH 7/7] sheepdog: remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (5 preceding siblings ...)
2016-06-15 16:14 ` [Qemu-devel] [PATCH 6/7] crypto: " Laurent Vivier
@ 2016-06-15 16:14 ` Laurent Vivier
2016-06-17 3:23 ` Hitoshi Mitake
2016-06-23 11:03 ` [Qemu-devel] [PATCH 0/7] Remove " Laurent Vivier
2016-09-14 7:18 ` Michael Tokarev
8 siblings, 1 reply; 16+ messages in thread
From: Laurent Vivier @ 2016-06-15 16:14 UTC (permalink / raw)
To: qemu-trivial, qemu-devel; +Cc: Laurent Vivier, Hitoshi Mitake, qemu-block
This patch is the result of coccinelle script
scripts/coccinelle/typecast.cocci
CC: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
CC: qemu-block@nongnu.org
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
block/sheepdog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 23fbace..95e6a11 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1049,7 +1049,7 @@ static int parse_vdiname(BDRVSheepdogState *s, const char *filename,
const char *host_spec, *vdi_spec;
int nr_sep, ret;
- strstart(filename, "sheepdog:", (const char **)&filename);
+ strstart(filename, "sheepdog:", &filename);
p = q = g_strdup(filename);
/* count the number of separators */
@@ -2652,7 +2652,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
req.opcode = SD_OP_READ_VDIS;
req.data_length = max;
- ret = do_req(fd, s->aio_context, (SheepdogReq *)&req,
+ ret = do_req(fd, s->aio_context, &req,
vdi_inuse, &wlen, &rlen);
closesocket(fd);
--
2.5.5
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts
2016-06-15 16:14 ` [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts Laurent Vivier
@ 2016-06-15 16:34 ` Laszlo Ersek
0 siblings, 0 replies; 16+ messages in thread
From: Laszlo Ersek @ 2016-06-15 16:34 UTC (permalink / raw)
To: Laurent Vivier, qemu-trivial, qemu-devel
On 06/15/16 18:14, Laurent Vivier wrote:
> This patch is the result of coccinelle script
> scripts/coccinelle/typecast.cocci
>
> CC: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> hw/nvram/fw_cfg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 74a0079..9d84129 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -180,7 +180,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)
> temp = qemu_opt_get(opts, "splash-time");
> if (temp != NULL) {
> p = (char *)temp;
> - boot_splash_time = strtol(p, (char **)&p, 10);
> + boot_splash_time = strtol(p, &p, 10);
> }
> }
>
> @@ -240,7 +240,7 @@ static void fw_cfg_reboot(FWCfgState *s)
> temp = qemu_opt_get(opts, "reboot-timeout");
> if (temp != NULL) {
> p = (char *)temp;
> - reboot_timeout = strtol(p, (char **)&p, 10);
> + reboot_timeout = strtol(p, &p, 10);
> }
> }
> /* validate the input */
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 4/7] tricore: remove useless cast
2016-06-15 16:14 ` [Qemu-devel] [PATCH 4/7] tricore: " Laurent Vivier
@ 2016-06-16 8:17 ` Bastian Koppelmann
0 siblings, 0 replies; 16+ messages in thread
From: Bastian Koppelmann @ 2016-06-16 8:17 UTC (permalink / raw)
To: Laurent Vivier, qemu-trivial, qemu-devel
On 06/15/2016 06:14 PM, Laurent Vivier wrote:
> This patch is the result of coccinelle script
> scripts/coccinelle/typecast.cocci
>
> CC: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> hw/tricore/tricore_testboard.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Cheers,
Bastian
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 7/7] sheepdog: remove useless casts
2016-06-15 16:14 ` [Qemu-devel] [PATCH 7/7] sheepdog: " Laurent Vivier
@ 2016-06-17 3:23 ` Hitoshi Mitake
0 siblings, 0 replies; 16+ messages in thread
From: Hitoshi Mitake @ 2016-06-17 3:23 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-trivial, qemu-devel, Hitoshi Mitake, qemu-block
At Wed, 15 Jun 2016 18:14:37 +0200,
Laurent Vivier wrote:
>
> This patch is the result of coccinelle script
> scripts/coccinelle/typecast.cocci
>
> CC: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
> CC: qemu-block@nongnu.org
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> block/sheepdog.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Reviewed-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp>
Thanks,
Hitoshi
>
> diff --git a/block/sheepdog.c b/block/sheepdog.c
> index 23fbace..95e6a11 100644
> --- a/block/sheepdog.c
> +++ b/block/sheepdog.c
> @@ -1049,7 +1049,7 @@ static int parse_vdiname(BDRVSheepdogState *s, const char *filename,
> const char *host_spec, *vdi_spec;
> int nr_sep, ret;
>
> - strstart(filename, "sheepdog:", (const char **)&filename);
> + strstart(filename, "sheepdog:", &filename);
> p = q = g_strdup(filename);
>
> /* count the number of separators */
> @@ -2652,7 +2652,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
> req.opcode = SD_OP_READ_VDIS;
> req.data_length = max;
>
> - ret = do_req(fd, s->aio_context, (SheepdogReq *)&req,
> + ret = do_req(fd, s->aio_context, &req,
> vdi_inuse, &wlen, &rlen);
>
> closesocket(fd);
> --
> 2.5.5
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] Remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (6 preceding siblings ...)
2016-06-15 16:14 ` [Qemu-devel] [PATCH 7/7] sheepdog: " Laurent Vivier
@ 2016-06-23 11:03 ` Laurent Vivier
2016-09-14 7:18 ` Michael Tokarev
8 siblings, 0 replies; 16+ messages in thread
From: Laurent Vivier @ 2016-06-23 11:03 UTC (permalink / raw)
To: qemu-trivial, qemu-devel
Ping?
Laurent
On 15/06/2016 18:14, Laurent Vivier wrote:
> This series is the result of the following coccinelle script:
>
> @@
> type T;
> T v;
> @@
> - (T *)&v
> + &v
>
> This script removes the cast of a variable when the variable
> is already of the casting type.
>
> The script is added in scripts/coccinelle by the first patch.
>
> Laurent Vivier (7):
> coccinelle: add a script to remove useless casts
> linux-user,s390x: remove useless cast
> s390x: remove useless cast
> tricore: remove useless cast
> fw_cfg: remove useless casts
> crypto: remove useless casts
> sheepdog: remove useless casts
>
> block/sheepdog.c | 4 ++--
> crypto/cipher-builtin.c | 4 ++--
> hw/nvram/fw_cfg.c | 4 ++--
> hw/s390x/sclp.c | 2 +-
> hw/tricore/tricore_testboard.c | 2 +-
> linux-user/signal.c | 2 +-
> scripts/coccinelle/typecast.cocci | 7 +++++++
> 7 files changed, 16 insertions(+), 9 deletions(-)
> create mode 100644 scripts/coccinelle/typecast.cocci
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 6/7] crypto: remove useless casts
2016-06-15 16:14 ` [Qemu-devel] [PATCH 6/7] crypto: " Laurent Vivier
@ 2016-06-23 11:07 ` Daniel P. Berrange
2016-09-14 7:40 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
1 sibling, 0 replies; 16+ messages in thread
From: Daniel P. Berrange @ 2016-06-23 11:07 UTC (permalink / raw)
To: Laurent Vivier; +Cc: qemu-trivial, qemu-devel
On Wed, Jun 15, 2016 at 06:14:36PM +0200, Laurent Vivier wrote:
> This patch is the result of coccinelle script
> scripts/coccinelle/typecast.cocci
>
> CC: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> crypto/cipher-builtin.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
> index 88963f6..d791c80 100644
> --- a/crypto/cipher-builtin.c
> +++ b/crypto/cipher-builtin.c
> @@ -132,7 +132,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
> {
> const QCryptoCipherBuiltinAESContext *aesctx = ctx;
>
> - qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
> + qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
> src, dst, length);
> }
>
> @@ -144,7 +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,
> + qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
> src, dst, length);
> }
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
I'm fine with this going in via qemu-trivial.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove useless casts
2016-06-15 16:14 ` [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove " Laurent Vivier
@ 2016-06-24 17:21 ` Eric Blake
0 siblings, 0 replies; 16+ messages in thread
From: Eric Blake @ 2016-06-24 17:21 UTC (permalink / raw)
To: Laurent Vivier, qemu-trivial, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 963 bytes --]
On 06/15/2016 10:14 AM, Laurent Vivier wrote:
> Script from LKML.
Link to a particular message?
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> scripts/coccinelle/typecast.cocci | 7 +++++++
> 1 file changed, 7 insertions(+)
> create mode 100644 scripts/coccinelle/typecast.cocci
>
> diff --git a/scripts/coccinelle/typecast.cocci b/scripts/coccinelle/typecast.cocci
> new file mode 100644
> index 0000000..be2183e
> --- /dev/null
> +++ b/scripts/coccinelle/typecast.cocci
> @@ -0,0 +1,7 @@
> +// Remove useless casts
> +@@
> +type T;
> +T v;
> +@@
> +- (T *)&v
> ++ &v
Since we're using C for the most part, do we also want to remove useless
casts in and out of void*?
But even if we do that, it could be separate. This patch looks good on
its own:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [PATCH 0/7] Remove useless casts
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
` (7 preceding siblings ...)
2016-06-23 11:03 ` [Qemu-devel] [PATCH 0/7] Remove " Laurent Vivier
@ 2016-09-14 7:18 ` Michael Tokarev
8 siblings, 0 replies; 16+ messages in thread
From: Michael Tokarev @ 2016-09-14 7:18 UTC (permalink / raw)
To: Laurent Vivier, qemu-trivial, qemu-devel
15.06.2016 19:14, Laurent Vivier wrote:
> This series is the result of the following coccinelle script:
>
> @@
> type T;
> T v;
> @@
> - (T *)&v
> + &v
>
> This script removes the cast of a variable when the variable
> is already of the casting type.
>
> The script is added in scripts/coccinelle by the first patch.
>
> Laurent Vivier (7):
> coccinelle: add a script to remove useless casts
> linux-user,s390x: remove useless cast
> s390x: remove useless cast
> tricore: remove useless cast
> fw_cfg: remove useless casts
> crypto: remove useless casts
> sheepdog: remove useless casts
>
> block/sheepdog.c | 4 ++--
> crypto/cipher-builtin.c | 4 ++--
> hw/nvram/fw_cfg.c | 4 ++--
> hw/s390x/sclp.c | 2 +-
> hw/tricore/tricore_testboard.c | 2 +-
> linux-user/signal.c | 2 +-
> scripts/coccinelle/typecast.cocci | 7 +++++++
> 7 files changed, 16 insertions(+), 9 deletions(-)
> create mode 100644 scripts/coccinelle/typecast.cocci
Applied all 7 to -trivial, thank you!
/mjt
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH 6/7] crypto: remove useless casts
2016-06-15 16:14 ` [Qemu-devel] [PATCH 6/7] crypto: " Laurent Vivier
2016-06-23 11:07 ` Daniel P. Berrange
@ 2016-09-14 7:40 ` Michael Tokarev
1 sibling, 0 replies; 16+ messages in thread
From: Michael Tokarev @ 2016-09-14 7:40 UTC (permalink / raw)
To: Laurent Vivier, qemu-trivial, qemu-devel
15.06.2016 19:14, Laurent Vivier пишет:
> This patch is the result of coccinelle script
> scripts/coccinelle/typecast.cocci
>
> CC: Daniel P. Berrange <berrange@redhat.com>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> crypto/cipher-builtin.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/crypto/cipher-builtin.c b/crypto/cipher-builtin.c
> index 88963f6..d791c80 100644
> --- a/crypto/cipher-builtin.c
> +++ b/crypto/cipher-builtin.c
> @@ -132,7 +132,7 @@ static void qcrypto_cipher_aes_xts_encrypt(const void *ctx,
> {
> const QCryptoCipherBuiltinAESContext *aesctx = ctx;
>
> - qcrypto_cipher_aes_ecb_encrypt((AES_KEY *)&aesctx->enc,
> + qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
> src, dst, length);
> }
>
> @@ -144,7 +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,
> + qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
> src, dst, length);
> }
This patch causes the following build failure:
CC crypto/block.o
In file included from
/build/qemu/git/crypto/cipher.c:156:0:crypto/cipher-builtin.c: In
function ‘qcrypto_cipher_aes_xts_encrypt’:
crypto/cipher-builtin.c:135:36: error: passing argument 1 of
‘qcrypto_cipher_aes_ecb_encrypt’ discards ‘const’ qualifier from pointer
target type [-Werror]
qcrypto_cipher_aes_ecb_encrypt(&aesctx->enc,
^
crypto/cipher-builtin.c:76:13: note: expected ‘struct AES_KEY *’ but
argument is of type ‘const struct AES_KEY *’
static void qcrypto_cipher_aes_ecb_encrypt(AES_KEY *key,
^
crypto/cipher-builtin.c: In function ‘qcrypto_cipher_aes_xts_decrypt’:
crypto/cipher-builtin.c:147:36: error: passing argument 1 of
‘qcrypto_cipher_aes_ecb_decrypt’ discards ‘const’ qualifier from pointer
target type [-Werror]
qcrypto_cipher_aes_ecb_decrypt(&aesctx->dec,
^
crypto/cipher-builtin.c:102:13: note: expected ‘struct AES_KEY *’ but
argument is of type ‘const struct AES_KEY *’
static void qcrypto_cipher_aes_ecb_decrypt(AES_KEY *key,
^
cc1: all warnings being treated as errors
It's interesting that the qemu functions accepts const argument,
while apparently this is wrong, as qcrypto functions modifies their
args. Looks like a bug either in qemu or qcrypto... :)
I'll reverted this change for now.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2016-09-14 7:41 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 16:14 [Qemu-devel] [PATCH 0/7] Remove useless casts Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 1/7] coccinelle: add a script to remove " Laurent Vivier
2016-06-24 17:21 ` Eric Blake
2016-06-15 16:14 ` [Qemu-devel] [PATCH 2/7] linux-user,s390x: remove useless cast Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 3/7] s390x: " Laurent Vivier
2016-06-15 16:14 ` [Qemu-devel] [PATCH 4/7] tricore: " Laurent Vivier
2016-06-16 8:17 ` Bastian Koppelmann
2016-06-15 16:14 ` [Qemu-devel] [PATCH 5/7] fw_cfg: remove useless casts Laurent Vivier
2016-06-15 16:34 ` Laszlo Ersek
2016-06-15 16:14 ` [Qemu-devel] [PATCH 6/7] crypto: " Laurent Vivier
2016-06-23 11:07 ` Daniel P. Berrange
2016-09-14 7:40 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
2016-06-15 16:14 ` [Qemu-devel] [PATCH 7/7] sheepdog: " Laurent Vivier
2016-06-17 3:23 ` Hitoshi Mitake
2016-06-23 11:03 ` [Qemu-devel] [PATCH 0/7] Remove " Laurent Vivier
2016-09-14 7:18 ` Michael Tokarev
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.