Skip to content

Commit

Permalink
livepatch: use appropriate type for buffer offset variables
Browse files Browse the repository at this point in the history
As was made noticeable by the last of the commits referenced below,
using a fixed-size type for such purposes is not only against
./CODING_STYLE, but can lead to actual issues. Switch to using size_t
instead, thus also allowing calculations to be lighter-weight in 32-bit
builds.

No functional change for 64-bit builds.

Link: https://gitlab.com/xen-project/xen/-/jobs/7136417308
Fixes: b145b4a ("livepatch: Handle arbitrary size names with the list operation")
Fixes: 5083e0f ("livepatch: Add metadata runtime retrieval mechanism")
Fixes: 43d5c5d ("xen: avoid UB in guest handle arithmetic")
Reported-by: Andrew Cooper <[email protected]>
Signed-off-by: Jan Beulich <[email protected]>
Reviewed-by: Ross Lagerwall <[email protected]>
Release-Acked-by: Oleksii Kurochko <[email protected]>
  • Loading branch information
jbeulich committed Jun 20, 2024
1 parent e2bb28d commit 62071a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xen/common/livepatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ static int livepatch_list(struct xen_sysctl_livepatch_list *list)
list->metadata_total_size = 0;
if ( list->nr )
{
uint64_t name_offset = 0, metadata_offset = 0;
size_t name_offset = 0, metadata_offset = 0;

list_for_each_entry( data, &payload_list, list )
{
Expand Down

0 comments on commit 62071a1

Please sign in to comment.