[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] livepatch: use appropriate type for buffer offset variables



commit 62071a1c16c4dbe765491e58e456fd3a19b33298
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jun 20 12:10:27 2024 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jun 20 12:10:27 2024 +0200

    livepatch: use appropriate type for buffer offset variables
    
    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: b145b4a39c13 ("livepatch: Handle arbitrary size names with the list 
operation")
    Fixes: 5083e0ff939d ("livepatch: Add metadata runtime retrieval mechanism")
    Fixes: 43d5c5d5f70b ("xen: avoid UB in guest handle arithmetic")
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/common/livepatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 502e264bc6..d93a556bcd 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -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 )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.