* [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers
@ 2022-12-26 7:02 Dong Chuanjian
2022-12-26 21:22 ` Ezequiel Garcia
0 siblings, 1 reply; 2+ messages in thread
From: Dong Chuanjian @ 2022-12-26 7:02 UTC (permalink / raw)
To: mchehab, hverkuil-cisco, nicolas.dufresne, sebastian.fricke, ezequiel
Cc: linux-media, linux-kernel, Dong Chuanjian
When the pointer variable is judged to be null, null is returned
directly.
Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
---
v2: Directly return when pointer allocation fails.
diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
index 72bd64f65198..0e7b35ae3e94 100644
--- a/drivers/media/v4l2-core/v4l2-h264.c
+++ b/drivers/media/v4l2-core/v4l2-h264.c
@@ -343,6 +343,8 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
int n = 0, i;
*out_str = kmalloc(tmp_str_size, GFP_KERNEL);
+ if (*out_str == NULL)
+ return NULL;
n += snprintf(*out_str + n, tmp_str_size - n, "|");
@@ -356,7 +358,6 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
longterm ? 'l' : 's',
ref_type_to_char(reflist[i].fields));
}
-
return *out_str;
}
--
2.18.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers
2022-12-26 7:02 [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers Dong Chuanjian
@ 2022-12-26 21:22 ` Ezequiel Garcia
0 siblings, 0 replies; 2+ messages in thread
From: Ezequiel Garcia @ 2022-12-26 21:22 UTC (permalink / raw)
To: Dong Chuanjian
Cc: mchehab, hverkuil-cisco, nicolas.dufresne, sebastian.fricke,
linux-media, linux-kernel
Hi,
On Mon, Dec 26, 2022 at 03:02:36PM +0800, Dong Chuanjian wrote:
> When the pointer variable is judged to be null, null is returned
> directly.
>
> Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
> ---
> v2: Directly return when pointer allocation fails.
>
> diff --git a/drivers/media/v4l2-core/v4l2-h264.c b/drivers/media/v4l2-core/v4l2-h264.c
> index 72bd64f65198..0e7b35ae3e94 100644
> --- a/drivers/media/v4l2-core/v4l2-h264.c
> +++ b/drivers/media/v4l2-core/v4l2-h264.c
> @@ -343,6 +343,8 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
> int n = 0, i;
>
> *out_str = kmalloc(tmp_str_size, GFP_KERNEL);
> + if (*out_str == NULL)
> + return NULL;
>
format_ref_list_p has the same issue.
> n += snprintf(*out_str + n, tmp_str_size - n, "|");
>
> @@ -356,7 +358,6 @@ static const char *format_ref_list_b(const struct v4l2_h264_reflist_builder *bui
> longterm ? 'l' : 's',
> ref_type_to_char(reflist[i].fields));
> }
> -
Avoid spurious changes.
> return *out_str;
> }
>
> --
> 2.18.2
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-26 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-26 7:02 [PATCH v2] drivers/media/v4l2-core/v4l2-h264 : add detection of null pointers Dong Chuanjian
2022-12-26 21:22 ` Ezequiel Garcia
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.