Messages in this thread | | | Date | Tue, 30 Apr 2024 10:17:59 +0300 | From | Dan Carpenter <> | Subject | Re: [PATCH v2 1/4] usb: typec: ucsi: Fix null deref in trace |
| |
On Wed, Apr 24, 2024 at 01:48:18AM +0000, Jameson Thies wrote: > From: Abhishek Pandit-Subedi <abhishekpandit@chromium.org> > > ucsi_register_altmode checks IS_ERR on returned pointer and treats > NULL as valid. This results in a null deref when > trace_ucsi_register_altmode is called. Return an error from > ucsi_register_displayport when it is not supported and register the > altmode with typec_port_register_altmode. > > Reviewed-by: Jameson Thies <jthies@google.com> > Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
This is not the correct way to fix this. The normal thing to do would be to add NULL checks.
https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/'
regards, dan carpenter
| |