[OPW,kernel] Fix stack failure generating warning frame size larger than 1024 bytes
diff mbox

Message ID 526a51c5.c469440a.4cc3.ffffe341@mx.google.com
State Changes Requested
Headers show

Commit Message

ritas1188@gmail.com Oct. 25, 2013, 11:10 a.m. UTC
From: RITA SINHA <ritas1188@gmail.com>

Signed-off-by: RITA SINHA <ritas1188@gmail.com>
---
 drivers/staging/dgap/dgap_driver.c |    4 +++-
 drivers/staging/dgap/dgap_fep5.c   |   10 +++++++---
 drivers/staging/dgap/dgap_tty.c    |    7 +++++--
 3 files changed, 15 insertions(+), 6 deletions(-)

Comments

Greg KH Oct. 28, 2013, 9:42 p.m. UTC | #1
On Fri, Oct 25, 2013 at 04:40:27PM +0530, ritas1188@gmail.com wrote:
> From: RITA SINHA <ritas1188@gmail.com>
> 
> Signed-off-by: RITA SINHA <ritas1188@gmail.com>

You need a better Subject: line, look at the other patches on the
mailing list for examples.

Also, why the ALL CAPS for your name?

And, I need a description in the changelog body of what you are doing
here.


> ---
>  drivers/staging/dgap/dgap_driver.c |    4 +++-
>  drivers/staging/dgap/dgap_fep5.c   |   10 +++++++---
>  drivers/staging/dgap/dgap_tty.c    |    7 +++++--
>  3 files changed, 15 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/dgap/dgap_driver.c b/drivers/staging/dgap/dgap_driver.c
> index 4c1515e..f799283 100644
> --- a/drivers/staging/dgap/dgap_driver.c
> +++ b/drivers/staging/dgap/dgap_driver.c
> @@ -945,10 +945,11 @@ void *dgap_driver_kzmalloc(size_t size, int priority)
>   */
>  static void dgap_mbuf(struct board_t *brd, const char *fmt, ...) {
>  	va_list		ap;
> -	char		buf[1024];
>  	int		i;
>  	unsigned long	flags;
>  	size_t		length;
> +	char *buf = NULL;
> +	buf = kmalloc(1024, GFP_KERNEL);

Why assign it to NULL and then to the result of kmalloc right away?

Also, please put in a new line after the variable list.

And you forgot to check if the call to kmalloc() was successful.

And, are you sure you can use GFP_KERNEL here in this function?

Same goes for your other changes in this patch.

thanks,

greg k-h

Patch
diff mbox

diff --git a/drivers/staging/dgap/dgap_driver.c b/drivers/staging/dgap/dgap_driver.c
index 4c1515e..f799283 100644
--- a/drivers/staging/dgap/dgap_driver.c
+++ b/drivers/staging/dgap/dgap_driver.c
@@ -945,10 +945,11 @@  void *dgap_driver_kzmalloc(size_t size, int priority)
  */
 static void dgap_mbuf(struct board_t *brd, const char *fmt, ...) {
 	va_list		ap;
-	char		buf[1024];
 	int		i;
 	unsigned long	flags;
 	size_t		length;
+	char *buf = NULL;
+	buf = kmalloc(1024, GFP_KERNEL);
 
 	DGAP_LOCK(dgap_global_lock, flags);
 
@@ -972,6 +973,7 @@  static void dgap_mbuf(struct board_t *brd, const char *fmt, ...) {
 	brd->msgbuf += length;
 
 	DGAP_UNLOCK(dgap_global_lock, flags);
+	kfree(buf);
 }
 
 
diff --git a/drivers/staging/dgap/dgap_fep5.c b/drivers/staging/dgap/dgap_fep5.c
index 794cf9d..30864d6 100644
--- a/drivers/staging/dgap/dgap_fep5.c
+++ b/drivers/staging/dgap/dgap_fep5.c
@@ -72,8 +72,9 @@  void dgap_do_config_load(uchar __user *uaddr, int len)
 	int orig_len = len;
 	char *to_addr;
 	uchar __user *from_addr = uaddr;
-	char buf[U2BSIZE];
 	int n;
+	char *buf = NULL;
+	buf = kmalloc(U2BSIZE, GFP_KERNEL);
 
 	to_addr = dgap_config_buf = dgap_driver_kzmalloc(len + 1, GFP_ATOMIC);
 	if (!dgap_config_buf) {
@@ -107,7 +108,8 @@  void dgap_do_config_load(uchar __user *uaddr, int len)
 	dgap_parsefile(&to_addr, TRUE);
 
 	DPR_INIT(("dgap_config_load() finish\n"));
-
+	
+	kfree(buf);
 	return;
 }
 
@@ -146,8 +148,9 @@  int dgap_after_config_loaded(void)
  *=======================================================================*/
 static int dgap_usertoboard(struct board_t *brd, char *to_addr, char __user *from_addr, int len)
 {
-	char buf[U2BSIZE];
 	int n = U2BSIZE;
+	char *buf = NULL;
+	buf = kmalloc(U2BSIZE, GFP_KERNEL);
 
 	if (!brd || brd->magic != DGAP_BOARD_MAGIC)
 		return -EFAULT;
@@ -169,6 +172,7 @@  static int dgap_usertoboard(struct board_t *brd, char *to_addr, char __user *fro
 		from_addr += n;   
 		n = U2BSIZE;
         }
+	kfree(buf);
 	return 0;
 }
 
diff --git a/drivers/staging/dgap/dgap_tty.c b/drivers/staging/dgap/dgap_tty.c
index 2a7a372..4e466f4 100644
--- a/drivers/staging/dgap/dgap_tty.c
+++ b/drivers/staging/dgap/dgap_tty.c
@@ -556,9 +556,11 @@  static void dgap_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *b
 	int nbuf;
 	int i;
 	int tmpbuflen;
-	char tmpbuf[TMPBUFLEN];
-	char *p = tmpbuf;
 	int too_much_data;
+	char *tmpbuf = NULL;
+	char *p = NULL;
+	tmpbuf = kmalloc(TMPBUFLEN, GFP_KERNEL);
+	p = tmpbuf;
 
 	/* Leave if sniff not open */
 	if (!(ch->ch_sniff_flags & SNIFF_OPEN))
@@ -655,6 +657,7 @@  static void dgap_sniff_nowait_nolock(struct channel_t *ch, uchar *text, uchar *b
 		}
 
 	} while (too_much_data);
+	kfree(tmpbuf);
 }