All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Re: [PATCH] thunderbolt: Check for null pointer after calling kmemdup
@ 2022-01-05  8:53 Jiasheng Jiang
  2022-01-05 10:11 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-01-05  8:53 UTC (permalink / raw)
  To: mika.westerberg
  Cc: andreas.noever, michael.jamet, YehezkelShB, linux-usb,
	linux-kernel, Jiasheng Jiang

On Wed, Jan 05, 2022 at 03:30:47PM +0800, Mika Westerberg wrote:
> This is doing two things so I suggest sending two patches instead.

Fine, I have already sent the patch for icm_handle_event() independently.

> However, for the UUID part, I think it works fine if we get NULL (and I
> think kmemdup() issues warning too).
>
> There are probably not needed either since the "fix" here is for pretty
> rare case of running out of memory. I think there is not even a NULL
> pointer dereference because UUID is optional.

As for icm_icl_set_uuid(), I think the check for kmemdup() is needed.
Because users need to know that icm_start() fails, or they will be puzzled
why the uuid is unsetted.
So at least it is a cleanup.
if so, I would like to send patch for icm_icl_set_uuid() without fixes tag.


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

* Re: Re: [PATCH] thunderbolt: Check for null pointer after calling kmemdup
  2022-01-05  8:53 Re: [PATCH] thunderbolt: Check for null pointer after calling kmemdup Jiasheng Jiang
@ 2022-01-05 10:11 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2022-01-05 10:11 UTC (permalink / raw)
  To: Jiasheng Jiang
  Cc: andreas.noever, michael.jamet, YehezkelShB, linux-usb, linux-kernel

On Wed, Jan 05, 2022 at 04:53:07PM +0800, Jiasheng Jiang wrote:
> On Wed, Jan 05, 2022 at 03:30:47PM +0800, Mika Westerberg wrote:
> > This is doing two things so I suggest sending two patches instead.
> 
> Fine, I have already sent the patch for icm_handle_event() independently.

Thanks!

> > However, for the UUID part, I think it works fine if we get NULL (and I
> > think kmemdup() issues warning too).
> >
> > There are probably not needed either since the "fix" here is for pretty
> > rare case of running out of memory. I think there is not even a NULL
> > pointer dereference because UUID is optional.
> 
> As for icm_icl_set_uuid(), I think the check for kmemdup() is needed.
> Because users need to know that icm_start() fails, or they will be puzzled
> why the uuid is unsetted.
> So at least it is a cleanup.
> if so, I would like to send patch for icm_icl_set_uuid() without fixes tag.

I don't think icm_start() actually fails because if this. If the UUID is
not set tb_switch_add() will look it up from the host router vendor area
then.

We can log a warning or something like that (but I think that's already
done in kmemdup()).

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

end of thread, other threads:[~2022-01-05 10:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05  8:53 Re: [PATCH] thunderbolt: Check for null pointer after calling kmemdup Jiasheng Jiang
2022-01-05 10:11 ` Mika Westerberg

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.