linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] S3C: NAND: Check the existence of nr_map before copying
@ 2010-01-13 17:31 Ramax Lo
  2010-01-13 18:26 ` Aguirre, Sergio
  0 siblings, 1 reply; 3+ messages in thread
From: Ramax Lo @ 2010-01-13 17:31 UTC (permalink / raw)
  To: linux-arm-kernel

We need to check whether the chip number map is provided to avoid unexpected
NULL pointer exception.

Signed-off-by: Ramax Lo <ramaxlo@gmail.com>
---
 arch/arm/plat-s3c/dev-nand.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
index 84808cc..34697de 100644
--- a/arch/arm/plat-s3c/dev-nand.c
+++ b/arch/arm/plat-s3c/dev-nand.c
@@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set)
 			return -ENOMEM;
 	}
 	
-	size = sizeof(int) * set->nr_chips;
-	if (size) {
+	if (set->nr_map) {
+		size = sizeof(int) * set->nr_chips;
 		ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
 		set->nr_map = ptr;
 
-- 
1.5.4.3

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

* [PATCH] S3C: NAND: Check the existence of nr_map before copying
  2010-01-13 17:31 [PATCH] S3C: NAND: Check the existence of nr_map before copying Ramax Lo
@ 2010-01-13 18:26 ` Aguirre, Sergio
  2010-01-14  1:48   ` Ramax Lo
  0 siblings, 1 reply; 3+ messages in thread
From: Aguirre, Sergio @ 2010-01-13 18:26 UTC (permalink / raw)
  To: linux-arm-kernel

Ramax,

> -----Original Message-----
> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
> kernel-bounces at lists.infradead.org] On Behalf Of Ramax Lo
> Sent: Wednesday, January 13, 2010 11:31 AM
> To: linux-arm-kernel at lists.infradead.org
> Cc: ben-linux at fluff.org
> Subject: [PATCH] S3C: NAND: Check the existence of nr_map before copying
> 
> We need to check whether the chip number map is provided to avoid
> unexpected
> NULL pointer exception.
> 
> Signed-off-by: Ramax Lo <ramaxlo@gmail.com>
> ---
>  arch/arm/plat-s3c/dev-nand.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
> index 84808cc..34697de 100644
> --- a/arch/arm/plat-s3c/dev-nand.c
> +++ b/arch/arm/plat-s3c/dev-nand.c
> @@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct
> s3c2410_nand_set *set)
>  			return -ENOMEM;
>  	}
> 
> -	size = sizeof(int) * set->nr_chips;
> -	if (size) {
> +	if (set->nr_map) {

Shouldn't the above condition be:

	if (set->nr_map && set->nr_chips) {

?

Regards,
Sergio

> +		size = sizeof(int) * set->nr_chips;
>  		ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
>  		set->nr_map = ptr;
> 
> --
> 1.5.4.3
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] S3C: NAND: Check the existence of nr_map before copying
  2010-01-13 18:26 ` Aguirre, Sergio
@ 2010-01-14  1:48   ` Ramax Lo
  0 siblings, 0 replies; 3+ messages in thread
From: Ramax Lo @ 2010-01-14  1:48 UTC (permalink / raw)
  To: linux-arm-kernel

2010/1/14 Aguirre, Sergio <saaguirre@ti.com>:
> Ramax,
>
>> -----Original Message-----
>> From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm-
>> kernel-bounces at lists.infradead.org] On Behalf Of Ramax Lo
>> Sent: Wednesday, January 13, 2010 11:31 AM
>> To: linux-arm-kernel at lists.infradead.org
>> Cc: ben-linux at fluff.org
>> Subject: [PATCH] S3C: NAND: Check the existence of nr_map before copying
>>
>> We need to check whether the chip number map is provided to avoid
>> unexpected
>> NULL pointer exception.
>>
>> Signed-off-by: Ramax Lo <ramaxlo@gmail.com>
>> ---
>> ?arch/arm/plat-s3c/dev-nand.c | ? ?4 ++--
>> ?1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/plat-s3c/dev-nand.c b/arch/arm/plat-s3c/dev-nand.c
>> index 84808cc..34697de 100644
>> --- a/arch/arm/plat-s3c/dev-nand.c
>> +++ b/arch/arm/plat-s3c/dev-nand.c
>> @@ -58,8 +58,8 @@ static int __init s3c_nand_copy_set(struct
>> s3c2410_nand_set *set)
>> ? ? ? ? ? ? ? ? ? ? ? return -ENOMEM;
>> ? ? ? }
>>
>> - ? ? size = sizeof(int) * set->nr_chips;
>> - ? ? if (size) {
>> + ? ? if (set->nr_map) {
>
> Shouldn't the above condition be:
>
> ? ? ? ?if (set->nr_map && set->nr_chips) {
>
> ?

Ok, I will fix that.

>
> Regards,
> Sergio
>
>> + ? ? ? ? ? ? size = sizeof(int) * set->nr_chips;
>> ? ? ? ? ? ? ? ptr = kmemdup(set->nr_map, size, GFP_KERNEL);
>> ? ? ? ? ? ? ? set->nr_map = ptr;
>>
>> --
>> 1.5.4.3
>>
>>
>> _______________________________________________
>> linux-arm-kernel mailing list
>> linux-arm-kernel at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

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

end of thread, other threads:[~2010-01-14  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-13 17:31 [PATCH] S3C: NAND: Check the existence of nr_map before copying Ramax Lo
2010-01-13 18:26 ` Aguirre, Sergio
2010-01-14  1:48   ` Ramax Lo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).