mirror of
https://github.com/ipxe/ipxe
synced 2026-05-13 03:41:15 +03:00
[image] Use image name rather than pointer value in all debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
+14
-14
@@ -76,8 +76,8 @@ static int gzip_extract ( struct image *image, struct image *extracted ) {
|
||||
/* Skip extra header, if present */
|
||||
if ( header->flags & GZIP_FL_EXTRA ) {
|
||||
if ( len < sizeof ( *extra ) ) {
|
||||
DBGC ( image, "GZIP %p overlength extra header\n",
|
||||
image );
|
||||
DBGC ( image, "GZIP %s overlength extra header\n",
|
||||
image->name );
|
||||
return -EINVAL;
|
||||
}
|
||||
extra = data;
|
||||
@@ -85,8 +85,8 @@ static int gzip_extract ( struct image *image, struct image *extracted ) {
|
||||
len -= sizeof ( *extra );
|
||||
extra_len = le16_to_cpu ( extra->len );
|
||||
if ( len < extra_len ) {
|
||||
DBGC ( image, "GZIP %p overlength extra header\n",
|
||||
image );
|
||||
DBGC ( image, "GZIP %s overlength extra header\n",
|
||||
image->name );
|
||||
return -EINVAL;
|
||||
}
|
||||
data += extra_len;
|
||||
@@ -102,8 +102,8 @@ static int gzip_extract ( struct image *image, struct image *extracted ) {
|
||||
while ( strings-- ) {
|
||||
string_len = strnlen ( data, len );
|
||||
if ( string_len == len ) {
|
||||
DBGC ( image, "GZIP %p overlength name/comment\n",
|
||||
image );
|
||||
DBGC ( image, "GZIP %s overlength name/comment\n",
|
||||
image->name );
|
||||
return -EINVAL;
|
||||
}
|
||||
data += ( string_len + 1 /* NUL */ );
|
||||
@@ -113,8 +113,8 @@ static int gzip_extract ( struct image *image, struct image *extracted ) {
|
||||
/* Skip CRC, if present */
|
||||
if ( header->flags & GZIP_FL_HCRC ) {
|
||||
if ( len < sizeof ( *crc ) ) {
|
||||
DBGC ( image, "GZIP %p overlength CRC header\n",
|
||||
image );
|
||||
DBGC ( image, "GZIP %s overlength CRC header\n",
|
||||
image->name );
|
||||
return -EINVAL;
|
||||
}
|
||||
data += sizeof ( *crc );
|
||||
@@ -124,16 +124,16 @@ static int gzip_extract ( struct image *image, struct image *extracted ) {
|
||||
/* Presize extracted image */
|
||||
if ( ( rc = image_set_len ( extracted,
|
||||
le32_to_cpu ( footer->len ) ) ) != 0 ) {
|
||||
DBGC ( image, "GZIP %p could not presize: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "GZIP %s could not presize: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Decompress image (expanding if necessary) */
|
||||
if ( ( rc = zlib_deflate ( DEFLATE_RAW, data, len,
|
||||
extracted ) ) != 0 ) {
|
||||
DBGC ( image, "GZIP %p could not decompress: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "GZIP %s could not decompress: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -152,14 +152,14 @@ static int gzip_probe ( struct image *image ) {
|
||||
|
||||
/* Sanity check */
|
||||
if ( image->len < ( sizeof ( *header ) + sizeof ( *footer ) ) ) {
|
||||
DBGC ( image, "GZIP %p image too short\n", image );
|
||||
DBGC ( image, "GZIP %s image too short\n", image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
header = image->data;
|
||||
|
||||
/* Check magic header */
|
||||
if ( header->magic != cpu_to_be16 ( GZIP_MAGIC ) ) {
|
||||
DBGC ( image, "GZIP %p invalid magic\n", image );
|
||||
DBGC ( image, "GZIP %s invalid magic\n", image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -71,15 +71,15 @@ int zlib_deflate ( enum deflate_format format, const void *data, size_t len,
|
||||
/* Decompress data */
|
||||
if ( ( rc = deflate_inflate ( deflate, data, len,
|
||||
&out ) ) != 0 ) {
|
||||
DBGC ( extracted, "ZLIB %p could not decompress: %s\n",
|
||||
extracted, strerror ( rc ) );
|
||||
DBGC ( extracted, "ZLIB %s could not decompress: %s\n",
|
||||
extracted->name, strerror ( rc ) );
|
||||
goto err_inflate;
|
||||
}
|
||||
|
||||
/* Check that decompression is valid */
|
||||
if ( ! deflate_finished ( deflate ) ) {
|
||||
DBGC ( extracted, "ZLIB %p decompression incomplete\n",
|
||||
extracted );
|
||||
DBGC ( extracted, "ZLIB %s decompression incomplete\n",
|
||||
extracted->name );
|
||||
rc = -EINVAL;
|
||||
goto err_unfinished;
|
||||
}
|
||||
@@ -90,8 +90,8 @@ int zlib_deflate ( enum deflate_format format, const void *data, size_t len,
|
||||
|
||||
/* Otherwise, resize output image and retry */
|
||||
if ( ( rc = image_set_len ( extracted, out.offset ) ) != 0 ) {
|
||||
DBGC ( extracted, "ZLIB %p could not resize: %s\n",
|
||||
extracted, strerror ( rc ) );
|
||||
DBGC ( extracted, "ZLIB %s could not resize: %s\n",
|
||||
extracted->name, strerror ( rc ) );
|
||||
goto err_set_size;
|
||||
}
|
||||
}
|
||||
@@ -136,14 +136,14 @@ static int zlib_probe ( struct image *image ) {
|
||||
|
||||
/* Sanity check */
|
||||
if ( image->len < sizeof ( *magic ) ) {
|
||||
DBGC ( image, "ZLIB %p image too short\n", image );
|
||||
DBGC ( image, "ZLIB %s image too short\n", image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
magic = image->data;
|
||||
|
||||
/* Check magic header */
|
||||
if ( ! zlib_magic_is_valid ( magic ) ) {
|
||||
DBGC ( image, "ZLIB %p invalid magic data\n", image );
|
||||
DBGC ( image, "ZLIB %s invalid magic data\n", image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user