diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/decompress_inflate.c | 8 | ||||
| -rw-r--r-- | lib/decompress_unlzma.c | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/decompress_inflate.c b/lib/decompress_inflate.c index 68dfce59c1b8..fc686c7a0a0d 100644 --- a/lib/decompress_inflate.c +++ b/lib/decompress_inflate.c | |||
| @@ -27,6 +27,11 @@ | |||
| 27 | 27 | ||
| 28 | #define GZIP_IOBUF_SIZE (16*1024) | 28 | #define GZIP_IOBUF_SIZE (16*1024) |
| 29 | 29 | ||
| 30 | static int nofill(void *buffer, unsigned int len) | ||
| 31 | { | ||
| 32 | return -1; | ||
| 33 | } | ||
| 34 | |||
| 30 | /* Included from initramfs et al code */ | 35 | /* Included from initramfs et al code */ |
| 31 | STATIC int INIT gunzip(unsigned char *buf, int len, | 36 | STATIC int INIT gunzip(unsigned char *buf, int len, |
| 32 | int(*fill)(void*, unsigned int), | 37 | int(*fill)(void*, unsigned int), |
| @@ -76,6 +81,9 @@ STATIC int INIT gunzip(unsigned char *buf, int len, | |||
| 76 | goto gunzip_nomem4; | 81 | goto gunzip_nomem4; |
| 77 | } | 82 | } |
| 78 | 83 | ||
| 84 | if (!fill) | ||
| 85 | fill = nofill; | ||
| 86 | |||
| 79 | if (len == 0) | 87 | if (len == 0) |
| 80 | len = fill(zbuf, GZIP_IOBUF_SIZE); | 88 | len = fill(zbuf, GZIP_IOBUF_SIZE); |
| 81 | 89 | ||
diff --git a/lib/decompress_unlzma.c b/lib/decompress_unlzma.c index 0b954e04bd30..ca82fde81c8f 100644 --- a/lib/decompress_unlzma.c +++ b/lib/decompress_unlzma.c | |||
| @@ -82,6 +82,11 @@ struct rc { | |||
| 82 | #define RC_MODEL_TOTAL_BITS 11 | 82 | #define RC_MODEL_TOTAL_BITS 11 |
| 83 | 83 | ||
| 84 | 84 | ||
| 85 | static int nofill(void *buffer, unsigned int len) | ||
| 86 | { | ||
| 87 | return -1; | ||
| 88 | } | ||
| 89 | |||
| 85 | /* Called twice: once at startup and once in rc_normalize() */ | 90 | /* Called twice: once at startup and once in rc_normalize() */ |
| 86 | static void INIT rc_read(struct rc *rc) | 91 | static void INIT rc_read(struct rc *rc) |
| 87 | { | 92 | { |
| @@ -97,7 +102,10 @@ static inline void INIT rc_init(struct rc *rc, | |||
| 97 | int (*fill)(void*, unsigned int), | 102 | int (*fill)(void*, unsigned int), |
| 98 | char *buffer, int buffer_size) | 103 | char *buffer, int buffer_size) |
| 99 | { | 104 | { |
| 100 | rc->fill = fill; | 105 | if (fill) |
| 106 | rc->fill = fill; | ||
| 107 | else | ||
| 108 | rc->fill = nofill; | ||
| 101 | rc->buffer = (uint8_t *)buffer; | 109 | rc->buffer = (uint8_t *)buffer; |
| 102 | rc->buffer_size = buffer_size; | 110 | rc->buffer_size = buffer_size; |
| 103 | rc->buffer_end = rc->buffer + rc->buffer_size; | 111 | rc->buffer_end = rc->buffer + rc->buffer_size; |
