[syslinux] [PATCH 1/2] msg: VGAFilePtr should be char

Charles (Chas) Williams 3chas3 at gmail.com
Fri Aug 21 15:01:29 PDT 2015


On Fri, 2015-08-21 at 12:33 -0700, Patrick Masotta wrote:
> I think probably this patch is buggy:
> 
> You have redefined VGAFilePtr
> 
>  -__export  uint16_t  *VGAFilePtr;    /* Pointer into VGAFileBuf */  
>  +__export char       *VGAFilePtr;    /* Pointer into VGAFileBuf */
> 
> but you did not redefine i.e.
> 
>  *VGAFilePtr++ = data;
> 
> Incrementing a pointer to "uint16_t" implies moving the pointer forward 2 bytes
> while incrementing a pointer to "char" moves the pointer forward only 1 byte.
> Then the next pointer de-referencing would point to the wrong location

I don't understand your point.  Since VGAFilePtr is now a char after
the patch, if you increment it, it only changes by one byte.  That was
the point of the diff in the first place.  Since the types now agree,
you can also get rid of the cast. 

I believe the original author was attempting to use VGAFilterPtr as a
native 16 bit pointer but confused the pointer arithmetic.

> Was  this code working when you tested it?

It works.




More information about the Syslinux mailing list