grub2/0203-Adjust-types-in-gdb-module-to-have-intended-unsigned.patch
Peter Jones f74b50e380 Rebase to upstream, fix a pile of bugs. The usual.
Signed-off-by: Peter Jones <pjones@redhat.com>
2013-06-12 15:37:08 -04:00

79 lines
2.3 KiB
Diff

From 03976ab690ee925d6bd752c6996856dbf0a40a74 Mon Sep 17 00:00:00 2001
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Date: Sun, 10 Mar 2013 18:36:39 +0100
Subject: [PATCH 203/482] Adjust types in gdb module to have intended
unsigned shifts rather than signed divisions.
---
ChangeLog | 5 +++++
grub-core/gdb/cstub.c | 4 ++--
grub-core/gdb/i386/signal.c | 2 +-
include/grub/gdb.h | 2 +-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 931ae8e..51bc363 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2013-03-10 Vladimir Serbinenko <phcoder@gmail.com>
+ Adjust types in gdb module to have intended unsigned shifts rather than
+ signed divisions.
+
+2013-03-10 Vladimir Serbinenko <phcoder@gmail.com>
+
* grub-core/fs/hfs.c (grub_hfs_read_file): Avoid divmod64 since the
maximum size is 4G - 1 on hfs
diff --git a/grub-core/gdb/cstub.c b/grub-core/gdb/cstub.c
index a5c0c43..3c89c19 100644
--- a/grub-core/gdb/cstub.c
+++ b/grub-core/gdb/cstub.c
@@ -204,7 +204,7 @@ grub_gdb_hex2int (char **ptr, grub_uint64_t *int_value)
void
grub_gdb_trap (int trap_no)
{
- int sig_no;
+ unsigned int sig_no;
int stepping;
grub_uint64_t addr;
grub_uint64_t length;
@@ -264,7 +264,7 @@ grub_gdb_trap (int trap_no)
case '?':
grub_gdb_outbuf[0] = 'S';
grub_gdb_outbuf[1] = hexchars[sig_no >> 4];
- grub_gdb_outbuf[2] = hexchars[sig_no % 16];
+ grub_gdb_outbuf[2] = hexchars[sig_no & 0xf];
grub_gdb_outbuf[3] = 0;
break;
diff --git a/grub-core/gdb/i386/signal.c b/grub-core/gdb/i386/signal.c
index 23b7c35..1ac3bbd 100644
--- a/grub-core/gdb/i386/signal.c
+++ b/grub-core/gdb/i386/signal.c
@@ -24,7 +24,7 @@
/* Converting CPU trap number to UNIX signal number as
described in System V ABI i386 Processor Supplement, 3-25. */
-int
+unsigned int
grub_gdb_trap2sig (int trap_no)
{
const int signals[] = {
diff --git a/include/grub/gdb.h b/include/grub/gdb.h
index 59fd456..e73d135 100644
--- a/include/grub/gdb.h
+++ b/include/grub/gdb.h
@@ -33,7 +33,7 @@ struct grub_serial_port;
extern struct grub_serial_port *grub_gdb_port;
void grub_gdb_breakpoint (void);
-int grub_gdb_trap2sig (int);
+unsigned int grub_gdb_trap2sig (int);
#endif /* ! GRUB_GDB_HEADER */
--
1.8.2.1