All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pch_uart: Don't panic if dmi_get_system_info returns NULL
@ 2011-06-01 12:11 Alexander Stein
  2011-06-08 21:44 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Stein @ 2011-06-01 12:11 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alexander Stein

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 drivers/tty/serial/pch_uart.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index f2cb750..4652109 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1397,6 +1397,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	int fifosize, base_baud;
 	int port_type;
 	struct pch_uart_driver_data *board;
+	const char *board_name;
 
 	board = &drv_dat[id->driver_data];
 	port_type = board->port_type;
@@ -1412,7 +1413,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	base_baud = 1843200; /* 1.8432MHz */
 
 	/* quirk for CM-iTC board */
-	if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
+	board_name = dmi_get_system_info(DMI_BOARD_NAME);
+	if (board_name && strstr(board_name, "CM-iTC"))
 		base_baud = 192000000; /* 192.0MHz */
 
 	switch (port_type) {
-- 
1.7.3.4


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

* Re: [PATCH] pch_uart: Don't panic if dmi_get_system_info returns NULL
  2011-06-01 12:11 [PATCH] pch_uart: Don't panic if dmi_get_system_info returns NULL Alexander Stein
@ 2011-06-08 21:44 ` Andrew Morton
  2011-06-09 11:21   ` [PATCH v2] pch_uart: Don't oops " Alexander Stein
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2011-06-08 21:44 UTC (permalink / raw)
  To: Alexander Stein; +Cc: linux-kernel, Greg KH

On Wed,  1 Jun 2011 14:11:25 +0200
Alexander Stein <alexander.stein@systec-electronic.com> wrote:

> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
>  drivers/tty/serial/pch_uart.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
> index f2cb750..4652109 100644
> --- a/drivers/tty/serial/pch_uart.c
> +++ b/drivers/tty/serial/pch_uart.c
> @@ -1397,6 +1397,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
>  	int fifosize, base_baud;
>  	int port_type;
>  	struct pch_uart_driver_data *board;
> +	const char *board_name;
>  
>  	board = &drv_dat[id->driver_data];
>  	port_type = board->port_type;
> @@ -1412,7 +1413,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
>  	base_baud = 1843200; /* 1.8432MHz */
>  
>  	/* quirk for CM-iTC board */
> -	if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
> +	board_name = dmi_get_system_info(DMI_BOARD_NAME);
> +	if (board_name && strstr(board_name, "CM-iTC"))
>  		base_baud = 192000000; /* 192.0MHz */
>  
>  	switch (port_type) {

Please changelog your patches.

A changelog for this patch would include info such as:

a) The code doesn't panic.  I think you meant "oops due to a NULL
   pointer dereference"

b) Under what circumstances will dmi_get_system_info() return NULL?

c) Has this bug been observed in the real world, or was it from code
   inspection?  If the former, under what circumstances?

The answer to c) will allow others to decide which kernel version(s)
the fix should be merged into.

Thanks.

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

* [PATCH v2] pch_uart: Don't oops if dmi_get_system_info returns NULL
  2011-06-08 21:44 ` Andrew Morton
@ 2011-06-09 11:21   ` Alexander Stein
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Stein @ 2011-06-09 11:21 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Greg KH, linux-kernel, Alexander Stein

This oops was observed on an Atom based board which has no BIOS, but
a bootloder which doesn't privde DMI data.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
Changesin v2:
* Adjust summary
* Describe when dmi_get_system_info could return NULL

If this is ok, i will send an updated patch for the pch_phub too.

 drivers/tty/serial/pch_uart.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index f2cb750..4652109 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -1397,6 +1397,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	int fifosize, base_baud;
 	int port_type;
 	struct pch_uart_driver_data *board;
+	const char *board_name;
 
 	board = &drv_dat[id->driver_data];
 	port_type = board->port_type;
@@ -1412,7 +1413,8 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
 	base_baud = 1843200; /* 1.8432MHz */
 
 	/* quirk for CM-iTC board */
-	if (strstr(dmi_get_system_info(DMI_BOARD_NAME), "CM-iTC"))
+	board_name = dmi_get_system_info(DMI_BOARD_NAME);
+	if (board_name && strstr(board_name, "CM-iTC"))
 		base_baud = 192000000; /* 192.0MHz */
 
 	switch (port_type) {
-- 
1.7.3.4


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

end of thread, other threads:[~2011-06-09 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-01 12:11 [PATCH] pch_uart: Don't panic if dmi_get_system_info returns NULL Alexander Stein
2011-06-08 21:44 ` Andrew Morton
2011-06-09 11:21   ` [PATCH v2] pch_uart: Don't oops " Alexander Stein

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.