[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v2 1/4] xen/console: Don't treat NUL character as the end of the buffer
- To: Julien Grall <julien.grall@xxxxxxx>
- From: Jan Beulich <JBeulich@xxxxxxxx>
- Date: Thu, 8 Aug 2019 13:51:11 +0000
- Accept-language: en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=obb1I9ZPpTa0RvlN0vC1ktwHVOVeZ+in+LnGaL+HSnA=; b=fQg9sjb0VlJzyFoJiHiFvsJq/qkdnRRQbB1DjvYzVRKVzJVmW+t/y2FJagF1mUIOu33dcf8X8APxhUMvdH6QQfmjrCf2bGe12EO0YDE4OWfnnR8nDgNR4EGCOkFqjjWg7UpF1Z/npOQ+WlofFVqXutIKKE+ZnvdkNfLo2Wv6fFMWhxjW7y27NPx4XXcZUQTPue+yzd0QpjCmNGJwV/XwXcSQ2hobgSrTmBjDn9TQXdTsJg30GMezvFInaHYQbkGWKPrRhjQGpcDwOa5ibVXHa3EVa5dGEblwinIx6UUFOPcUWtN7qyqCWLIOuhGN8RD8MDYWMZ+a15ZcU8VTVGVOCw==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cb+gMM/hfz1ecyFkd816e8hoZnNvmtUu98KU+qNpC8bzsnituh8ZC38FF+kBErZZbL6QDs4HNX/t+UUVO1oNYSLNs9dy4SOtyBkrLRC0oizguNTLQWNkIxvRCC4gtB42eDMY15I6ORyECGtjq8opFXod1h8q7mguArZai/qZd9/auSKYeJaMLuF1e7lzVYRBYN+JXF+TOkFDjH/9RXRoFxUOO0ccBHhcBZVnoc6vWwv1mlxZl6En16EvkHW6xF0ymNTwOsdPzTCorHg9AHnNspwjDK4jjXyaTaxUpGqXD5gf64Fh6l9myDvWAIg/JbME4VcU6eYTJuv3ocmejdd1oQ==
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=JBeulich@xxxxxxxx;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, George Dunlap <George.Dunlap@xxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Ian Jackson <ian.jackson@xxxxxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Thu, 08 Aug 2019 14:00:25 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHVS5HylAe3eE1UcUur5OQYZ6SMtKbxSYOA
- Thread-topic: [PATCH v2 1/4] xen/console: Don't treat NUL character as the end of the buffer
On 05.08.2019 15:29, Julien Grall wrote:
> @@ -1261,14 +1259,15 @@ void debugtrace_printk(const char *fmt, ...)
> ASSERT(debugtrace_buf[debugtrace_bytes - 1] == 0);
>
> va_start(args, fmt);
> - vsnprintf(buf, sizeof(buf), fmt, args);
> + nr = vscnprintf(buf, sizeof(buf), fmt, args);
> va_end(args);
>
> if ( debugtrace_send_to_console )
> {
> - snprintf(cntbuf, sizeof(cntbuf), "%u ", ++count);
> - serial_puts(sercon_handle, cntbuf);
> - serial_puts(sercon_handle, buf);
> + unsigned int n = snprintf(cntbuf, sizeof(cntbuf), "%u ", ++count);
While - given the size of cntbuf - the difference is mostly
benign, you using vscnprintf() above calls for you also
using scnprintf() here.
> --- a/xen/include/xen/video.h
> +++ b/xen/include/xen/video.h
> @@ -13,11 +13,11 @@
>
> #ifdef CONFIG_VIDEO
> void video_init(void);
> -extern void (*video_puts)(const char *);
> +extern void (*video_puts)(const char *, size_t nr);
> void video_endboot(void);
> #else
> #define video_init() ((void)0)
> -#define video_puts(s) ((void)0)
> +#define video_puts(s, nr) ((void)0)
While I don't think there's overly much risk of "s" getting an
argument with side effects passed, I think that for "nr" the
risk is there. May I ask that you evaluate both here, just in
case?
Preferably with these adjustments
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|