diff options
author | Daniel Kiper <daniel.kiper@oracle.com> | 2022-03-10 16:48:50 +0100 |
---|---|---|
committer | Daniel Kiper <daniel.kiper@oracle.com> | 2022-03-14 23:05:00 +0100 |
commit | 9c9bb1c0ac6278a0c81c1191881f5a158855f29f (patch) | |
tree | afb3b37016cddb170a70579488510868fb481e17 | |
parent | 093ac51dc6c022bbb7402ba8b632ee68325944d3 (diff) | |
download | grub-9c9bb1c0ac6278a0c81c1191881f5a158855f29f.tar.gz |
commands/i386/pc/sendkey: Fix "writing 1 byte into a region of size 0" build error
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>
-rw-r--r-- | grub-core/commands/i386/pc/sendkey.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/grub-core/commands/i386/pc/sendkey.c b/grub-core/commands/i386/pc/sendkey.c index af91cc835..184befabf 100644 --- a/grub-core/commands/i386/pc/sendkey.c +++ b/grub-core/commands/i386/pc/sendkey.c @@ -220,8 +220,8 @@ grub_sendkey_postboot (void) *flags = oldflags; - *((char *) 0x41a) = 0x1e; - *((char *) 0x41c) = 0x1e; + *((volatile char *) 0x41a) = 0x1e; + *((volatile char *) 0x41c) = 0x1e; return GRUB_ERR_NONE; } @@ -236,8 +236,8 @@ grub_sendkey_preboot (int noret __attribute__ ((unused))) 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. */ |