summaryrefslogtreecommitdiff
path: root/kexec/arch
diff options
context:
space:
mode:
Diffstat (limited to 'kexec/arch')
-rw-r--r--kexec/arch/arm/kexec-uImage-arm.c2
-rw-r--r--kexec/arch/i386/kexec-beoboot-x86.c2
-rw-r--r--kexec/arch/i386/kexec-bzImage.c7
-rw-r--r--kexec/arch/i386/kexec-nbi.c2
-rw-r--r--kexec/arch/ppc/kexec-dol-ppc.c3
-rw-r--r--kexec/arch/sh/kexec-uImage-sh.c2
6 files changed, 10 insertions, 8 deletions
diff --git a/kexec/arch/arm/kexec-uImage-arm.c b/kexec/arch/arm/kexec-uImage-arm.c
index 2291aae..e881fd8 100644
--- a/kexec/arch/arm/kexec-uImage-arm.c
+++ b/kexec/arch/arm/kexec-uImage-arm.c
@@ -12,7 +12,7 @@ int uImage_arm_probe(const char *buf, off_t len)
{
struct image_header header;
- if (len < sizeof(header))
+ if ((uintmax_t)len < (uintmax_t)sizeof(header))
return -1;
memcpy(&header, buf, sizeof(header));
diff --git a/kexec/arch/i386/kexec-beoboot-x86.c b/kexec/arch/i386/kexec-beoboot-x86.c
index dd7f098..27c5a2c 100644
--- a/kexec/arch/i386/kexec-beoboot-x86.c
+++ b/kexec/arch/i386/kexec-beoboot-x86.c
@@ -43,7 +43,7 @@ int beoboot_probe(const char *buf, off_t len)
struct beoboot_header bb_header;
const char *cmdline, *kernel;
int result;
- if (len < sizeof(bb_header)) {
+ if ((uintmax_t)len < (uintmax_t)sizeof(bb_header)) {
return -1;
}
memcpy(&bb_header, buf, sizeof(bb_header));
diff --git a/kexec/arch/i386/kexec-bzImage.c b/kexec/arch/i386/kexec-bzImage.c
index 825beee..c1345d5 100644
--- a/kexec/arch/i386/kexec-bzImage.c
+++ b/kexec/arch/i386/kexec-bzImage.c
@@ -44,7 +44,7 @@ static const int probe_debug = 0;
int bzImage_probe(const char *buf, off_t len)
{
struct x86_linux_header header;
- if (len < sizeof(header)) {
+ if ((uintmax_t)len < (uintmax_t)sizeof(header)) {
return -1;
}
memcpy(&header, buf, sizeof(header));
@@ -119,7 +119,7 @@ int do_bzImage_load(struct kexec_info *info,
/*
* Find out about the file I am about to load.
*/
- if (kernel_len < sizeof(setup_header)) {
+ if ((uintmax_t)kernel_len < (uintmax_t)sizeof(setup_header)) {
return -1;
}
memcpy(&setup_header, kernel, sizeof(setup_header));
@@ -136,7 +136,8 @@ int do_bzImage_load(struct kexec_info *info,
}
if (setup_header.protocol_version >= 0x0206) {
- if (command_line_len > setup_header.cmdline_size) {
+ if ((uintmax_t)command_line_len >
+ (uintmax_t)setup_header.cmdline_size) {
dbgprintf("Kernel command line too long for kernel!\n");
return -1;
}
diff --git a/kexec/arch/i386/kexec-nbi.c b/kexec/arch/i386/kexec-nbi.c
index 469d669..443a3a7 100644
--- a/kexec/arch/i386/kexec-nbi.c
+++ b/kexec/arch/i386/kexec-nbi.c
@@ -74,7 +74,7 @@ int nbi_probe(const char *buf, off_t len)
struct segheader seg;
off_t seg_off;
/* If we don't have enough data give up */
- if ((len < sizeof(hdr)) || (len < 512)) {
+ if (((uintmax_t)len < (uintmax_t)sizeof(hdr)) || (len < 512)) {
return -1;
}
memcpy(&hdr, buf, sizeof(hdr));
diff --git a/kexec/arch/ppc/kexec-dol-ppc.c b/kexec/arch/ppc/kexec-dol-ppc.c
index 429c8ab..83c122a 100644
--- a/kexec/arch/ppc/kexec-dol-ppc.c
+++ b/kexec/arch/ppc/kexec-dol-ppc.c
@@ -265,7 +265,8 @@ int dol_ppc_probe(const char *buf, off_t dol_length)
}
/* end of physical storage must be within file */
- if (dol_sect_offset(h, i) + dol_sect_size(h, i) > dol_length) {
+ if ((uintmax_t)(dol_sect_offset(h, i) + dol_sect_size(h, i)) >
+ (uintmax_t)dol_length) {
if (debug) {
fprintf(stderr,
"%s segment past DOL file size\n",
diff --git a/kexec/arch/sh/kexec-uImage-sh.c b/kexec/arch/sh/kexec-uImage-sh.c
index 869bbd4..c2bce53 100644
--- a/kexec/arch/sh/kexec-uImage-sh.c
+++ b/kexec/arch/sh/kexec-uImage-sh.c
@@ -14,7 +14,7 @@ int uImage_sh_probe(const char *buf, off_t len)
{
struct image_header header;
- if (len < sizeof(header))
+ if ((uintmax_t)len < (uintmax_t)sizeof(header))
return -1;
memcpy(&header, buf, sizeof(header));