public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] acpi: add checking for NULL early param
@ 2008-08-20 23:41 akpm
  2008-08-21  6:46 ` Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: akpm @ 2008-08-20 23:41 UTC (permalink / raw)
  To: andi; +Cc: linux-acpi, akpm, gorcunov

From: Cyrill Gorcunov <gorcunov@gmail.com>

The early_param handling function could recieve NULL pointer as argument
in case if user didn't enter parameter value.  So we have to be ready for
a such situation and do check for NULL pointer if needed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/acpi/tables.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN drivers/acpi/tables.c~acpi-add-checking-for-null-early-param drivers/acpi/tables.c
--- a/drivers/acpi/tables.c~acpi-add-checking-for-null-early-param
+++ a/drivers/acpi/tables.c
@@ -300,6 +300,8 @@ int __init acpi_table_init(void)
 
 static int __init acpi_parse_apic_instance(char *str)
 {
+	if (!str)
+		return -EINVAL;
 
 	acpi_apic_instance = simple_strtoul(str, NULL, 0);
 
_

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

* Re: [patch 1/2] acpi: add checking for NULL early param
  2008-08-20 23:41 [patch 1/2] acpi: add checking for NULL early param akpm
@ 2008-08-21  6:46 ` Andi Kleen
  2008-08-21 15:34   ` Cyrill Gorcunov
  0 siblings, 1 reply; 3+ messages in thread
From: Andi Kleen @ 2008-08-21  6:46 UTC (permalink / raw)
  To: akpm; +Cc: linux-acpi, gorcunov

akpm@linux-foundation.org writes:

> From: Cyrill Gorcunov <gorcunov@gmail.com>
>
> The early_param handling function could recieve NULL pointer as argument
> in case if user didn't enter parameter value.  So we have to be ready for
> a such situation and do check for NULL pointer if needed.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> Cc: Andi Kleen <andi@firstfloor.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Queued for 2.6.27. Thanks.

But I wonder if it wouldn't be generally safer for the caller to just pass
an empty string instead of NULL in this case?

-Andi

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

* Re: [patch 1/2] acpi: add checking for NULL early param
  2008-08-21  6:46 ` Andi Kleen
@ 2008-08-21 15:34   ` Cyrill Gorcunov
  0 siblings, 0 replies; 3+ messages in thread
From: Cyrill Gorcunov @ 2008-08-21 15:34 UTC (permalink / raw)
  To: Andi Kleen; +Cc: akpm, linux-acpi

[Andi Kleen - Thu, Aug 21, 2008 at 08:46:12AM +0200]
| akpm@linux-foundation.org writes:
| 
| > From: Cyrill Gorcunov <gorcunov@gmail.com>
| >
| > The early_param handling function could recieve NULL pointer as argument
| > in case if user didn't enter parameter value.  So we have to be ready for
| > a such situation and do check for NULL pointer if needed.
| >
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > Cc: Andi Kleen <andi@firstfloor.org>
| > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
| 
| Queued for 2.6.27. Thanks.
| 
| But I wonder if it wouldn't be generally safer for the caller to just pass
| an empty string instead of NULL in this case?
| 
| -Andi
| 

Actually this would require to patch kernel code not in
one place. There was some discusion about this	

	http://lkml.org/lkml/2008/8/12/229
	

- in short it could lead to hidden bug since not all
users of early_param are ready for this and they have
to be checked.

		- Cyrill -

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

end of thread, other threads:[~2008-08-21 15:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-20 23:41 [patch 1/2] acpi: add checking for NULL early param akpm
2008-08-21  6:46 ` Andi Kleen
2008-08-21 15:34   ` Cyrill Gorcunov

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