* [PATCH] tty: timbuart: Check for null res pointer
@ 2021-12-20 8:21 Jiasheng Jiang
2021-12-20 13:29 ` Jiri Slaby
2021-12-20 15:40 ` Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Jiasheng Jiang @ 2021-12-20 8:21 UTC (permalink / raw)
To: gregkh, jirislaby; +Cc: linux-serial, linux-kernel, Jiasheng Jiang
The return value of platform_get_resource() needs to be checked.
To avoid use of error pointer in case that there is no suitable
resource.
Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/tty/serial/timbuart.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
index 08941eabe7b1..262154d2f40f 100644
--- a/drivers/tty/serial/timbuart.c
+++ b/drivers/tty/serial/timbuart.c
@@ -312,9 +312,14 @@ static const char *timbuart_type(struct uart_port *port)
*/
static void timbuart_release_port(struct uart_port *port)
{
+ struct resource *res;
+ int size;
struct platform_device *pdev = to_platform_device(port->dev);
- int size =
- resource_size(platform_get_resource(pdev, IORESOURCE_MEM, 0));
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ size = 0;
+ else
+ size = resource_size(res);
if (port->flags & UPF_IOREMAP) {
iounmap(port->membase);
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: timbuart: Check for null res pointer
2021-12-20 8:21 [PATCH] tty: timbuart: Check for null res pointer Jiasheng Jiang
@ 2021-12-20 13:29 ` Jiri Slaby
2021-12-20 15:40 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2021-12-20 13:29 UTC (permalink / raw)
To: Jiasheng Jiang, gregkh; +Cc: linux-serial, linux-kernel
On 20. 12. 21, 9:21, Jiasheng Jiang wrote:
> The return value of platform_get_resource() needs to be checked.
> To avoid use of error pointer in case that there is no suitable
> resource.
>
> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
Barely.
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/tty/serial/timbuart.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/timbuart.c b/drivers/tty/serial/timbuart.c
> index 08941eabe7b1..262154d2f40f 100644
> --- a/drivers/tty/serial/timbuart.c
> +++ b/drivers/tty/serial/timbuart.c
> @@ -312,9 +312,14 @@ static const char *timbuart_type(struct uart_port *port)
> */
> static void timbuart_release_port(struct uart_port *port)
> {
> + struct resource *res;
> + int size;
> struct platform_device *pdev = to_platform_device(port->dev);
> - int size =
> - resource_size(platform_get_resource(pdev, IORESOURCE_MEM, 0));
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (!res)
> + size = 0;
How can this happen and what happens when you pass zero size to
release_mem_region?
> + else
> + size = resource_size(res);
>
> if (port->flags & UPF_IOREMAP) {
> iounmap(port->membase);
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tty: timbuart: Check for null res pointer
2021-12-20 8:21 [PATCH] tty: timbuart: Check for null res pointer Jiasheng Jiang
2021-12-20 13:29 ` Jiri Slaby
@ 2021-12-20 15:40 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2021-12-20 15:40 UTC (permalink / raw)
To: Jiasheng Jiang; +Cc: jirislaby, linux-serial, linux-kernel
On Mon, Dec 20, 2021 at 04:21:27PM +0800, Jiasheng Jiang wrote:
> The return value of platform_get_resource() needs to be checked.
> To avoid use of error pointer in case that there is no suitable
> resource.
>
> Fixes: ab4382d27412 ("tty: move drivers/serial/ to drivers/tty/serial/")
No it does not. I thought I said that already.
I am going to just add your emails to a "ignore filter" for a while.
Your changes are not correct, and when asked about them, you just send
another version of the patch, which is not how to have a conversation
about a review.
good luck,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-20 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-20 8:21 [PATCH] tty: timbuart: Check for null res pointer Jiasheng Jiang
2021-12-20 13:29 ` Jiri Slaby
2021-12-20 15:40 ` Greg KH
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.