mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sx.c: fix dbl statement if - add missing braces
@ 2009-02-18 13:52 Ilpo Järvinen
  2009-02-19  9:55 ` Dan Carpenter
  2009-02-19 12:24 ` Dan Carpenter
  0 siblings, 2 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2009-02-18 13:52 UTC (permalink / raw)
  To: Dan Carpenter, Andrew Morton; +Cc: LKML

[-- Attachment #1: Type: TEXT/PLAIN, Size: 978 bytes --]


Caused by 736d54533aed (sx.c: fix missed unlock_kernel()
on error path in sx_fw_ioctl()). You guys keep breaking
things this way in every single kernel release in at least
couple of places... :-(

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Cc: Dan Carpenter <error27@gmail.com>
---
 drivers/char/sx.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index f146e90..d7c4165 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1746,9 +1746,10 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
 		sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc);
 		break;
 	case SXIO_DO_RAMTEST:
-		if (sx_initialized)	/* Already initialized: better not ramtest the board.  */
+		if (sx_initialized) {	/* Already initialized: better not ramtest the board.  */
 			rc = -EPERM;
 			break;
+		}
 		if (IS_SX_BOARD(board)) {
 			rc = do_memtest(board, 0, 0x7000);
 			if (!rc)
-- 
1.5.2.2

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

* Re: [PATCH] sx.c: fix dbl statement if - add missing braces
  2009-02-18 13:52 [PATCH] sx.c: fix dbl statement if - add missing braces Ilpo Järvinen
@ 2009-02-19  9:55 ` Dan Carpenter
  2009-02-19 12:24 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2009-02-19  9:55 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: Andrew Morton, LKML

On 2/18/09, Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> wrote:
>
> Caused by 736d54533aed (sx.c: fix missed unlock_kernel()
> on error path in sx_fw_ioctl()). You guys keep breaking
> things this way in every single kernel release in at least
> couple of places... :-(
>

Yep.  Sorry about that.

Signed-off-by: Dan Carpenter <error27@gmail.com>

regards,
dan carpenter

> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> Cc: Dan Carpenter <error27@gmail.com>
> ---
>  drivers/char/sx.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/char/sx.c b/drivers/char/sx.c
> index f146e90..d7c4165 100644
> --- a/drivers/char/sx.c
> +++ b/drivers/char/sx.c
> @@ -1746,9 +1746,10 @@ static long sx_fw_ioctl(struct file *filp, unsigned
> int cmd,
>  		sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc);
>  		break;
>  	case SXIO_DO_RAMTEST:
> -		if (sx_initialized)	/* Already initialized: better not ramtest the board.
>  */
> +		if (sx_initialized) {	/* Already initialized: better not ramtest the
> board.  */
>  			rc = -EPERM;
>  			break;
> +		}
>  		if (IS_SX_BOARD(board)) {
>  			rc = do_memtest(board, 0, 0x7000);
>  			if (!rc)
> --
> 1.5.2.2
>

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

* Re: [PATCH] sx.c: fix dbl statement if - add missing braces
  2009-02-18 13:52 [PATCH] sx.c: fix dbl statement if - add missing braces Ilpo Järvinen
  2009-02-19  9:55 ` Dan Carpenter
@ 2009-02-19 12:24 ` Dan Carpenter
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2009-02-19 12:24 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: Dan Carpenter, Andrew Morton, LKML

While we're at it, here is another patch for that file.

The "break" would just result in reusing a free'd pointer.  I don't have 
the cards myself to test it though.  :/

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--- orig/drivers/char/sx.c	2009-02-19 11:27:51.000000000 +0300
+++ devel/drivers/char/sx.c	2009-02-19 11:29:05.000000000 +0300
@@ -1788,7 +1788,7 @@
  						nbytes - i : SX_CHUNK_SIZE)) {
  					kfree(tmp);
  					rc = -EFAULT;
-					break;
+					goto out;
  				}
  				memcpy_toio(board->base2 + offset + i, tmp,
  						(i + SX_CHUNK_SIZE > nbytes) ?
@@ -1845,6 +1845,7 @@
  		rc = -ENOTTY;
  		break;
  	}
+out:
  	unlock_kernel();
  	func_exit();
  	return rc;

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

end of thread, other threads:[~2009-02-19 12:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-18 13:52 [PATCH] sx.c: fix dbl statement if - add missing braces Ilpo Järvinen
2009-02-19  9:55 ` Dan Carpenter
2009-02-19 12:24 ` Dan Carpenter

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

all inboxes | Powered by JetHome®