All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"consulting @ bugseng . com" <consulting@bugseng.com>
Subject: Re: [PATCH 1/5] x86: Misra fixes for U/L suffixes
Date: Thu, 11 Dec 2025 08:39:20 +0100	[thread overview]
Message-ID: <a9cd462f7210e12a307b492c85e249b1@bugseng.com> (raw)
In-Reply-To: <673e625a-4df9-45fe-a45d-49d988197da8@citrix.com>

On 2025-12-11 00:48, Andrew Cooper wrote:
> On 10/12/2025 8:31 pm, Nicola Vetrini wrote:
>> On 2025-12-10 21:09, Nicola Vetrini wrote:
>>> On 2025-12-10 19:30, Andrew Cooper wrote:
>>>> diff --git a/xen/include/xen/elfstructs.h
>>>> b/xen/include/xen/elfstructs.h
>>>> index eb6b87a823a8..8770e7454672 100644
>>>> --- a/xen/include/xen/elfstructs.h
>>>> +++ b/xen/include/xen/elfstructs.h
>>>> @@ -360,7 +360,7 @@ typedef struct {
>>>>  } Elf64_Rela;
>>>> 
>>>>  #define    ELF64_R_SYM(info)    ((info) >> 32)
>>>> -#define    ELF64_R_TYPE(info)    ((info) & 0xFFFFFFFF)
>>>> +#define    ELF64_R_TYPE(info)    ((uint32_t)(info))
>> 
>> Actually I think this doesn't build:
>> 
>> arch/x86/livepatch.c: In function ‘arch_livepatch_perform_rela’:
>> ././include/xen/config.h:55:24: error: format ‘%lu’ expects argument
>> of type ‘long unsigned int’, but argument 3 has type ‘unsigned int’
>> [-Werror=format=]
>>    55 | #define XENLOG_ERR     "<0>"
>>       |                        ^~~~~
>> arch/x86/livepatch.c:332:20: note: in expansion of macro ‘XENLOG_ERR’
>>   332 |             printk(XENLOG_ERR LIVEPATCH "%s: Unhandled
>> relocation %lu\n",
>>       |                    ^~~~~~~~~~
>> arch/x86/livepatch.c:332:69: note: format string is defined here
>>   332 |             printk(XENLOG_ERR LIVEPATCH "%s: Unhandled
>> relocation %lu\n",
>>      
>> |                                                                  
>>  ~~^
>>      
>> |                                                                     
>> |
>>      
>> |                                                                    
>> long unsigned int
>>      
>> |                                                                   %u
>> 
>> the error location is a bit unclear, but the cast is the culprit
> 
> Yeah, I spotted that just as I heading out, and ran
> https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2207521982
> instead.
> 
> I've swapped back to using 0xFFFFFFFFU.  info ends up being long, and
> the result of the expression needs to stay that way.
> 
> However, looking at the report for that, I still missed one.  I've
> folded in this hunk too.
> 
> diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
> index 8c44dea12330..e741e686c1af 100644
> --- a/xen/arch/x86/pv/emulate.c
> +++ b/xen/arch/x86/pv/emulate.c
> @@ -37,7 +37,7 @@ int pv_emul_read_descriptor(unsigned int sel, const 
> struct vcpu *v,
>      if ( !(desc.b & _SEGMENT_L) )
>      {
>          *base = ((desc.a >> 16) + ((desc.b & 0xff) << 16) +
> -                 (desc.b & 0xff000000));
> +                 (desc.b & 0xff000000U));
>          *limit = (desc.a & 0xffff) | (desc.b & 0x000f0000);
>          if ( desc.b & _SEGMENT_G )
>              *limit = ((*limit + 1) << 12) - 1;
> 

Makes sense, feel free to retain my R-by with these two changes.

> 
> ~Andrew

-- 
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253


  reply	other threads:[~2025-12-11  7:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 18:30 [PATCH 0/5] x86: Misc MISRA fixes Andrew Cooper
2025-12-10 18:30 ` [PATCH 1/5] x86: Misra fixes for U/L suffixes Andrew Cooper
2025-12-10 20:09   ` Nicola Vetrini
2025-12-10 20:31     ` Nicola Vetrini
2025-12-10 23:48       ` Andrew Cooper
2025-12-11  7:39         ` Nicola Vetrini [this message]
2025-12-10 18:30 ` [PATCH 2/5] x86: Name parameters in function declarations Andrew Cooper
2025-12-10 20:15   ` Nicola Vetrini
2025-12-12  1:39     ` Andrew Cooper
2025-12-10 18:30 ` [PATCH 3/5] x86/ucode: Don't cast away const-ness in cmp_patch_id() Andrew Cooper
2025-12-10 20:37   ` Nicola Vetrini
2025-12-11  0:06     ` Stefano Stabellini
2025-12-10 18:30 ` [PATCH 4/5] x86: Fix missing breaks Andrew Cooper
2025-12-10 21:04   ` Nicola Vetrini
2025-12-10 18:30 ` [PATCH 5/5] x86: Fix missing brackets in macros Andrew Cooper
2025-12-10 21:11   ` Nicola Vetrini
2025-12-11  0:07     ` Stefano Stabellini
2025-12-11  8:36   ` Jan Beulich
2025-12-11  9:15     ` Nicola Vetrini
2025-12-11  9:30       ` Jan Beulich
2025-12-11 10:38         ` Nicola Vetrini
2025-12-11 12:28           ` Nicola Vetrini
2025-12-12  1:45             ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9cd462f7210e12a307b492c85e249b1@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=consulting@bugseng.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.