diff mbox series

[FFmpeg-devel] avfilter/vf_gblur_vulkan: Fix use of uninitialized value

Message ID 1637125494-32042-1-git-send-email-lance.lmwang@gmail.com
State Accepted
Commit be43eacb7eeaaf4632a40db3fad5ffe44872e4c4
Headers show
Series [FFmpeg-devel] avfilter/vf_gblur_vulkan: Fix use of uninitialized value | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Lance Wang Nov. 17, 2021, 5:04 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavfilter/vf_gblur_vulkan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lynne Nov. 17, 2021, 5:57 a.m. UTC | #1
17 Nov 2021, 06:04 by lance.lmwang@gmail.com:

> From: Limin Wang <lance.lmwang@gmail.com>
>
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_gblur_vulkan.c | 2 +- 
>

Pushed, thanks.
Andreas Rheinhardt Nov. 18, 2021, 4:30 a.m. UTC | #2
lance.lmwang@gmail.com:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavfilter/vf_gblur_vulkan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
> index d4f391b..16c8bbb 100644
> --- a/libavfilter/vf_gblur_vulkan.c
> +++ b/libavfilter/vf_gblur_vulkan.c
> @@ -124,7 +124,7 @@ static av_cold void init_gaussian_params(GBlurVulkanContext *s)
>  
>  static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
>  {
> -    int err;
> +    int err = 0;
>      char *kernel_def;
>      uint8_t *kernel_mapped;
>      FFSPIRVShader *shd;
> 

I don't see an uninitialized value at all: It is directly initialized in
some error paths and if not, it is initialized in the RET() macro. And
in any case it would be better to zero ret directly above the "fail:"
because then this function always returns zero on success even if the
last function called could return values > 0.

- Andreas
Lance Wang Nov. 18, 2021, 2:46 p.m. UTC | #3
On Thu, Nov 18, 2021 at 05:30:50AM +0100, Andreas Rheinhardt wrote:
> lance.lmwang@gmail.com:
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> >  libavfilter/vf_gblur_vulkan.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
> > index d4f391b..16c8bbb 100644
> > --- a/libavfilter/vf_gblur_vulkan.c
> > +++ b/libavfilter/vf_gblur_vulkan.c
> > @@ -124,7 +124,7 @@ static av_cold void init_gaussian_params(GBlurVulkanContext *s)
> >  
> >  static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
> >  {
> > -    int err;
> > +    int err = 0;
> >      char *kernel_def;
> >      uint8_t *kernel_mapped;
> >      FFSPIRVShader *shd;
> > 
> 
> I don't see an uninitialized value at all: It is directly initialized in
> some error paths and if not, it is initialized in the RET() macro. And
> in any case it would be better to zero ret directly above the "fail:"
> because then this function always returns zero on success even if the
> last function called could return values > 0.
yes, but it's very difficult to check out all place are initialized for all
errors, so I think it's better to make it initialized. By your comments,
I think it's more better to initialized to zero before failed, I'll resubmit
a patch.


> 
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavfilter/vf_gblur_vulkan.c b/libavfilter/vf_gblur_vulkan.c
index d4f391b..16c8bbb 100644
--- a/libavfilter/vf_gblur_vulkan.c
+++ b/libavfilter/vf_gblur_vulkan.c
@@ -124,7 +124,7 @@  static av_cold void init_gaussian_params(GBlurVulkanContext *s)
 
 static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
 {
-    int err;
+    int err = 0;
     char *kernel_def;
     uint8_t *kernel_mapped;
     FFSPIRVShader *shd;