mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 14/14] don't cast negative error codes to unsigned size_t
Date: Fri,  7 Feb 2014 09:48:56 +0100	[thread overview]
Message-ID: <1391762936-2747-15-git-send-email-dev@lynxeye.de> (raw)
In-Reply-To: <1391762936-2747-1-git-send-email-dev@lynxeye.de>

The cast prevents us from doing proper error checking.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 common/uimage.c | 6 +++---
 include/image.h | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/uimage.c b/common/uimage.c
index 7fbef86..4296359 100644
--- a/common/uimage.c
+++ b/common/uimage.c
@@ -74,7 +74,7 @@ void uimage_print_contents(struct uimage_handle *handle)
 }
 EXPORT_SYMBOL(uimage_print_contents);
 
-size_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no)
+int uimage_get_size(struct uimage_handle *handle, unsigned int image_no)
 {
 	if (image_no >= handle->nb_data_entries)
 		return -EINVAL;
@@ -373,7 +373,7 @@ struct resource *file_to_sdram(const char *filename, unsigned long adr)
 	struct resource *res;
 	size_t size = BUFSIZ;
 	size_t ofs = 0;
-	size_t now;
+	int now;
 	int fd;
 
 	fd = open(filename, O_RDONLY);
@@ -420,7 +420,7 @@ struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
 		int image_no, unsigned long load_address)
 {
 	int ret;
-	size_t size;
+	int size;
 	resource_size_t start = (resource_size_t)load_address;
 
 	uimage_buf = (void *)load_address;
diff --git a/include/image.h b/include/image.h
index 0c8a4b1..1592348 100644
--- a/include/image.h
+++ b/include/image.h
@@ -230,7 +230,7 @@ int uimage_verify(struct uimage_handle *handle);
 int uimage_load(struct uimage_handle *handle, unsigned int image_no,
 		int(*flush)(void*, unsigned int));
 void uimage_print_contents(struct uimage_handle *handle);
-size_t uimage_get_size(struct uimage_handle *handle, unsigned int image_no);
+int uimage_get_size(struct uimage_handle *handle, unsigned int image_no);
 struct resource *uimage_load_to_sdram(struct uimage_handle *handle,
 		int image_no, unsigned long load_address);
 void *uimage_load_to_buf(struct uimage_handle *handle, int image_no,
-- 
1.8.5.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2014-02-07  8:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  8:48 [PATCH 00/14] Smatch warning fixups Lucas Stach
2014-02-07  8:48 ` [PATCH 01/14] remove redundant NULL check on free Lucas Stach
2014-02-07  8:48 ` [PATCH 02/14] commands: edit: properly propagate error code Lucas Stach
2014-02-07  8:48 ` [PATCH 03/14] common: env: " Lucas Stach
2014-02-07  8:48 ` [PATCH 04/14] clk: imx: unsigned mfn is never less than zero Lucas Stach
2014-02-07  8:48 ` [PATCH 05/14] lib: math: fix return path (numstack may be NULL) Lucas Stach
2014-02-07  8:48 ` [PATCH 06/14] lib: libbb: f should never be NULL Lucas Stach
2014-02-07  8:48 ` [PATCH 07/14] comamnds: uimage: actually print error message Lucas Stach
2014-02-07  9:22   ` Uwe Kleine-König
2014-02-07  8:48 ` [PATCH 08/14] usb: ulpi: fix logic-op Lucas Stach
2014-02-07  8:48 ` [PATCH 09/14] usb: dfu: fix error path to avoid NULL ptr deref Lucas Stach
2014-02-07  8:48 ` [PATCH 10/14] net: usb: smsc95xx: fix wrong phy reset condition Lucas Stach
2014-02-07  8:48 ` [PATCH 11/14] net: usb: asix: properly propagate error code Lucas Stach
2014-02-07  8:48 ` [PATCH 12/14] mtd: core: avoid possible NULL ptr deref Lucas Stach
2014-02-07  8:48 ` [PATCH 13/14] clk: " Lucas Stach
2014-02-07  8:48 ` Lucas Stach [this message]
2014-02-07  9:17   ` [PATCH 14/14] don't cast negative error codes to unsigned size_t Juergen Beisert
2014-02-10  7:51 ` [PATCH 00/14] Smatch warning fixups Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391762936-2747-15-git-send-email-dev@lynxeye.de \
    --to=dev@lynxeye.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox