lkml.org 
[lkml]   [2012]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch] x86, efi: fix pointer math issue in handle_ramdisks()
    "filename" is a efi_char16_t string so this check for reaching the end
    of the array doesn't work. We need to cast it to char pointer before
    doing the math.

    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

    diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
    index fec216f..cf4cdb7 100644
    --- a/arch/x86/boot/compressed/eboot.c
    +++ b/arch/x86/boot/compressed/eboot.c
    @@ -559,7 +559,7 @@ static efi_status_t handle_ramdisks(efi_loaded_image_t *image,
    str++;

    while (*str && *str != ' ' && *str != '\n') {
    - if (p >= filename + sizeof(filename))
    + if ((char *)p >= (char *)filename + sizeof(filename))
    break;

    *p++ = *str++;

    \
     
     \ /
      Last update: 2012-03-02 20:05    [W:0.020 / U:64.396 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site