qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v5 6/9] qemu-log: new option -dfilter to limit o


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v5 6/9] qemu-log: new option -dfilter to limit output
Date: Fri, 5 Feb 2016 10:08:06 +1100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0

On 02/05/2016 01:56 AM, Alex Bennée wrote:
+            gchar *range_op = g_strstr_len(r, -1, "-");

This is strchr.

+                range_op = g_strstr_len(r, -1, ".");

Or at least if you're going to make use of strstr, search for "..".

+                g_strdelimit(range_val, ".", ' ');

Cause this is just weird.  It accepts "1+.2" just the same as "1..2".

+                err = qemu_strtoul(r, NULL, 0, &range.begin);

This should be strtoull.  You probably broke 32-bit compilation here.

+                case '+':
+                {
+                    unsigned long len;
+                    err |= qemu_strtoul(range_val, NULL, 0, &len);
+                    range.end = range.begin + len;
+                    break;
+                }
+                case '-':
+                {
+                    unsigned long len;
+                    err |= qemu_strtoul(range_val, NULL, 0, &len);
+                    range.end = range.begin;
+                    range.begin = range.end - len;
+                    break;
+                }

Both of these have off-by-one bugs, since end is inclusive.

+                case '.':
+                    err |= qemu_strtoul(range_val, NULL, 0, &range.end);
+                    break;

I'd think multiple dot detection belongs here, and you need not smash them to ' ' but merely notice that there are two of them and then strtoull range_val+1.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]