Re: [PATCH v7 3/7] xen/console: use memcpy() in conring_puts()

Jan Beulich <[email protected]>
Newsgroups org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On 17.07.2026 08:18, [email protected] wrote:
> On Thu, Jul 16, 2026 at 06:08:01PM +0200, Jan Beulich wrote:
>> On 13.07.2026 20:16, [email protected] wrote:
>>> --- a/xen/drivers/char/console.c
>>> +++ b/xen/drivers/char/console.c
>>> @@ -360,12 +360,22 @@ static DECLARE_SOFTIRQ_TASKLET(conring_tasklet, conring_notify, NULL);
>>>  /* NB: Do not send conring VIRQs during panic. */
>>>  static bool conring_no_notify;
>>>  
>>> -static void conring_puts(const char *str, size_t len)
>>> +static void conring_puts(const char *str, unsigned int len)
>>>  {
>>> +    unsigned int src = likely(len < conring_size) ? 0 : len - conring_size;
>>
>> Isn't the attempt to handle strings longer than conring_size pretty much in
>> vain? Things look correct as far as the rest of the logic in the function
>> goes, but is this useful? It certainly warrants at least a brief comment imo.
> 
> Thanks for taking a look!
> 
> I don't think there ever will callers of conring_puts() with strings longer
> than conring_size... and I could not decide whether to keep the extra check
> or not.

Having though about this a little more over night, I actually wonder whether
e.g. len > PAGE_SIZE wouldn't already be indicative of an error. And which
hence may instead want flagging by a BUG_ON(). REST maintainers, thoughts?

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.