Skip to contentSkip to conversation

tools/libs: guest: Fix Arm build after 8fc4916daf2a

PATCH In review Julien Grall 2 participants 3 messages May 18, 2021 – May 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libs: guest: Fix Arm build after 8fc4916daf2a

From: Julien Grall <[email protected]>

Gitlab CI spotted an issue when building the tools Arm:

xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:401:50: error: passing argument 3 of 'set_mode' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

  401 |     rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type);
      |                                               ~~~^~~~~~~~~~~~

This is because the const was not propagated in the Arm code. Fix it by constifying the 3rd parameter of set_mode().

Fixes 8fc4916daf2a ("tools/libs: guest: Use const whenever we point to literal strings")
---
 tools/libs/guest/xg_dom_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libs/guest/xg_dom_arm.c +1 -1
index b4c24f15fb27..01e85e0ea9c7 100644
@@ -195,7 +195,7 @@ static int vcpu_arm64(struct xc_dom_image *dom)
 
 /* ------------------------------------------------------------------------ */
 
-static int set_mode(xc_interface *xch, uint32_t domid, char *guest_type)
+static int set_mode(xc_interface *xch, uint32_t domid, const char *guest_type)
 {
     static const struct {
         char           *guest;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Julien Grall

From: Julien Grall <[email protected]>

Gitlab CI spotted an issue when building the tools Arm:

xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:401:50: error: passing argument 3 of 'set_mode' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

Quoted 8 lines
  401 |     rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type);
      |                                               ~~~^~~~~~~~~~~~

This is because the const was not propagated in the Arm code. Fix it by constifying the 3rd parameter of set_mode().

Fixes 8fc4916daf2a ("tools/libs: guest: Use const whenever we point to literal strings")
#2 lore raw

Hi,

Quoted 10 lines · Andrew Cooper
Quoted 9 lines · Julien Grall

From: Julien Grall <[email protected]>

Gitlab CI spotted an issue when building the tools Arm:

xg_dom_arm.c: In function 'meminit':
xg_dom_arm.c:401:50: error: passing argument 3 of 'set_mode' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]

   401 |     rc = set_mode(dom->xch, dom->guest_domid, dom->guest_type);
       |                                               ~~~^~~~~~~~~~~~
Quoted 7 lines
Quoted 5 lines

This is because the const was not propagated in the Arm code. Fix it by constifying the 3rd parameter of set_mode().

Fixes 8fc4916daf2a ("tools/libs: guest: Use const whenever we point to literal strings")

Thanks! I have committed with just your ack to unblock the build.

CHeers,

Signature · 1 line
Julien Grall