Message ID | 20190220010232.18731-6-philmd@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | chardev: Convert qemu_chr_write() to take a size_t argument | expand |
On Wed, Feb 20, 2019 at 2:04 AM Philippe Mathieu-Daudé <philmd@redhat.com> wrote: > > Since strlen() returns an unsigned value, it is pointless to > convert it to a signed one. Use size_t to hold its return value. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> (it looks like the variable is hiding len from outer scope btw) > --- > gdbstub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdbstub.c b/gdbstub.c > index bc774ae992..76eca3bb7e 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -1693,7 +1693,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) > } > #else /* !CONFIG_USER_ONLY */ > else if (strncmp(p, "Rcmd,", 5) == 0) { > - int len = strlen(p + 5); > + size_t len = strlen(p + 5); > > if ((len % 2) != 0) { > put_packet(s, "E01"); > -- > 2.20.1 >
diff --git a/gdbstub.c b/gdbstub.c index bc774ae992..76eca3bb7e 100644 --- a/gdbstub.c +++ b/gdbstub.c @@ -1693,7 +1693,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) } #else /* !CONFIG_USER_ONLY */ else if (strncmp(p, "Rcmd,", 5) == 0) { - int len = strlen(p + 5); + size_t len = strlen(p + 5); if ((len % 2) != 0) { put_packet(s, "E01");
Since strlen() returns an unsigned value, it is pointless to convert it to a signed one. Use size_t to hold its return value. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> --- gdbstub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)