mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] calloc: Fix possible memory leak
@ 2013-10-21 17:48 Alexander Shiyan
  2013-10-21 17:48 ` [PATCH 2/3] gadget: at91: Fix uninitialized variable Alexander Shiyan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexander Shiyan @ 2013-10-21 17:48 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 common/dlmalloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 7ad368e..b4341fe 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1750,11 +1750,11 @@ void *calloc(size_t n, size_t elem_size)
 	mchunkptr oldtop = top;
 	INTERNAL_SIZE_T oldtopsize = chunksize(top);
 
-	void *mem = malloc(sz);
-
 	if ((long)n < 0)
 		return NULL;
 
+	void *mem = malloc(sz);
+
 	if (!mem)
 		return NULL;
 	else {
-- 
1.8.1.5


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/3] gadget: at91: Fix uninitialized variable
  2013-10-21 17:48 [PATCH 1/3] calloc: Fix possible memory leak Alexander Shiyan
@ 2013-10-21 17:48 ` Alexander Shiyan
  2013-10-21 17:48 ` [PATCH 3/3] ubifs: Remove redundant assignment Alexander Shiyan
  2013-10-22  6:52 ` [PATCH 1/3] calloc: Fix possible memory leak Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Shiyan @ 2013-10-21 17:48 UTC (permalink / raw)
  To: barebox

Variable udc is used unitialized for DBG(xxx).

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/usb/gadget/at91_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index a11379c..acd9e44 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -414,6 +414,8 @@ static int at91_ep_queue(struct usb_ep *_ep,
 	req = container_of(_req, struct at91_request, req);
 	ep = container_of(_ep, struct at91_ep, ep);
 
+	udc = ep->udc;
+
 	if (!_req || !_req->complete
 			|| !_req->buf || !list_empty(&req->queue)) {
 		DBG(udc, "invalid request\n");
@@ -425,8 +427,6 @@ static int at91_ep_queue(struct usb_ep *_ep,
 		return -EINVAL;
 	}
 
-	udc = ep->udc;
-
 	if (!udc || !udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) {
 		DBG(udc, "invalid device\n");
 		return -EINVAL;
-- 
1.8.1.5


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 3/3] ubifs: Remove redundant assignment
  2013-10-21 17:48 [PATCH 1/3] calloc: Fix possible memory leak Alexander Shiyan
  2013-10-21 17:48 ` [PATCH 2/3] gadget: at91: Fix uninitialized variable Alexander Shiyan
@ 2013-10-21 17:48 ` Alexander Shiyan
  2013-10-22  6:52 ` [PATCH 1/3] calloc: Fix possible memory leak Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Alexander Shiyan @ 2013-10-21 17:48 UTC (permalink / raw)
  To: barebox


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 fs/ubifs/recovery.c | 1 -
 fs/ubifs/scan.c     | 1 -
 2 files changed, 2 deletions(-)

diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index df7262f..634ecb3 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -392,7 +392,6 @@ static void clean_buf(const struct ubifs_info *c, void **buf, int lnum,
 {
 	int empty_offs, pad_len;
 
-	lnum = lnum;
 	dbg_rcvry("cleaning corruption at %d:%d", lnum, *offs);
 
 	if (c->min_io_size == 1) {
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 0ed8247..633a56f 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -175,7 +175,6 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
 void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
 		    int lnum, int offs)
 {
-	lnum = lnum;
 	dbg_scan("stop scanning LEB %d at offset %d", lnum, offs);
 	ubifs_assert(offs % c->min_io_size == 0);
 
-- 
1.8.1.5


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/3] calloc: Fix possible memory leak
  2013-10-21 17:48 [PATCH 1/3] calloc: Fix possible memory leak Alexander Shiyan
  2013-10-21 17:48 ` [PATCH 2/3] gadget: at91: Fix uninitialized variable Alexander Shiyan
  2013-10-21 17:48 ` [PATCH 3/3] ubifs: Remove redundant assignment Alexander Shiyan
@ 2013-10-22  6:52 ` Sascha Hauer
  2 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2013-10-22  6:52 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Mon, Oct 21, 2013 at 09:48:23PM +0400, Alexander Shiyan wrote:
> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>

Applied all, thanks

Sascha

> ---
>  common/dlmalloc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/common/dlmalloc.c b/common/dlmalloc.c
> index 7ad368e..b4341fe 100644
> --- a/common/dlmalloc.c
> +++ b/common/dlmalloc.c
> @@ -1750,11 +1750,11 @@ void *calloc(size_t n, size_t elem_size)
>  	mchunkptr oldtop = top;
>  	INTERNAL_SIZE_T oldtopsize = chunksize(top);
>  
> -	void *mem = malloc(sz);
> -
>  	if ((long)n < 0)
>  		return NULL;
>  
> +	void *mem = malloc(sz);
> +
>  	if (!mem)
>  		return NULL;
>  	else {
> -- 
> 1.8.1.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-22  6:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-21 17:48 [PATCH 1/3] calloc: Fix possible memory leak Alexander Shiyan
2013-10-21 17:48 ` [PATCH 2/3] gadget: at91: Fix uninitialized variable Alexander Shiyan
2013-10-21 17:48 ` [PATCH 3/3] ubifs: Remove redundant assignment Alexander Shiyan
2013-10-22  6:52 ` [PATCH 1/3] calloc: Fix possible memory leak Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox