Latest GCC may complain in that way:
commands/i386/pc/sendkey.c: In function ‘grub_sendkey_postboot’:
commands/i386/pc/sendkey.c:223:21: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
223 | *((char *) 0x41a) = 0x1e;
| ~~~~~~~~~~~~~~~~~~^~~~~~
The volatile keyword addition helps and additionally assures us the
compiler will not optimize out fixed assignments.
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
*flags = oldflags;
- *((char *) 0x41a) = 0x1e;
- *((char *) 0x41c) = 0x1e;
+ *((volatile char *) 0x41a) = 0x1e;
+ *((volatile char *) 0x41c) = 0x1e;
return GRUB_ERR_NONE;
}
oldflags = *flags;
/* Set the sendkey. */
- *((char *) 0x41a) = 0x1e;
- *((char *) 0x41c) = keylen + 0x1e;
+ *((volatile char *) 0x41a) = 0x1e;
+ *((volatile char *) 0x41c) = keylen + 0x1e;
grub_memcpy ((char *) 0x41e, sendkey, 0x20);
/* Transform "any ctrl" to "right ctrl" flag. */