Message ID | 20240526235230.2876318-7-michael@niedermayer.cc |
---|---|
State | Accepted |
Commit | c841cb45e81ebece26768c820c459b085668a37a |
Headers | show |
Series | [FFmpeg-devel,01/17] avcodec/dxva2: Initialize dxva_size and check it | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Ma, 2024-05-27 at 01:52 +0200, Michael Niedermayer wrote: > Fixes: The warnings from CID1598553 Uninitialized scalar variable > > Passing partly initialized structs is ugly and asking for hard to reproduce > bugs, > I do not know if this actually fixes a bug or just avoids the uninitialized > fields LGTM, it might avoid issue in the future. Fortunately the uninitialized field is not used in the corresponding function call. Thanks Haihao > > Sponsored-by: Sovereign Tech Fund > Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> > --- > libavcodec/qsv.c | 2 +- > libavutil/hwcontext_qsv.c | 8 ++++---- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c > index 6bbfe2a5a95..0c6fbd0dc09 100644 > --- a/libavcodec/qsv.c > +++ b/libavcodec/qsv.c > @@ -496,7 +496,7 @@ static int qsv_new_mfx_loader(AVCodecContext *avctx, > mfxStatus sts; > mfxLoader loader = NULL; > mfxConfig cfg; > - mfxVariant impl_value; > + mfxVariant impl_value = {0}; > > loader = MFXLoad(); > if (!loader) { > diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c > index f3d919daea1..7cec3474786 100644 > --- a/libavutil/hwcontext_qsv.c > +++ b/libavutil/hwcontext_qsv.c > @@ -839,7 +839,7 @@ static int qsv_d3d11_update_config(void *ctx, mfxHDL > handle, mfxConfig cfg) > IDXGIDevice *pDXGIDevice = NULL; > HRESULT hr; > ID3D11Device *device = handle; > - mfxVariant impl_value; > + mfxVariant impl_value = {0}; > > hr = ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, > (void**)&pDXGIDevice); > if (SUCCEEDED(hr)) { > @@ -913,7 +913,7 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL > handle, mfxConfig cfg) > LUID luid; > D3DDEVICE_CREATION_PARAMETERS params; > HRESULT hr; > - mfxVariant impl_value; > + mfxVariant impl_value = {0}; > > hr = IDirect3DDeviceManager9_OpenDeviceHandle(devmgr, &device_handle); > if (FAILED(hr)) { > @@ -995,7 +995,7 @@ static int qsv_va_update_config(void *ctx, mfxHDL handle, > mfxConfig cfg) > VADisplayAttribute attr = { > .type = VADisplayPCIID, > }; > - mfxVariant impl_value; > + mfxVariant impl_value = {0}; > > vas = vaGetDisplayAttributes(dpy, &attr, 1); > if (vas == VA_STATUS_SUCCESS && attr.flags != > VA_DISPLAY_ATTRIB_NOT_SUPPORTED) { > @@ -1036,7 +1036,7 @@ static int qsv_new_mfx_loader(void *ctx, > mfxStatus sts; > mfxLoader loader = NULL; > mfxConfig cfg; > - mfxVariant impl_value; > + mfxVariant impl_value = {0}; > > *ploader = NULL; > loader = MFXLoad();
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 6bbfe2a5a95..0c6fbd0dc09 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -496,7 +496,7 @@ static int qsv_new_mfx_loader(AVCodecContext *avctx, mfxStatus sts; mfxLoader loader = NULL; mfxConfig cfg; - mfxVariant impl_value; + mfxVariant impl_value = {0}; loader = MFXLoad(); if (!loader) { diff --git a/libavutil/hwcontext_qsv.c b/libavutil/hwcontext_qsv.c index f3d919daea1..7cec3474786 100644 --- a/libavutil/hwcontext_qsv.c +++ b/libavutil/hwcontext_qsv.c @@ -839,7 +839,7 @@ static int qsv_d3d11_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) IDXGIDevice *pDXGIDevice = NULL; HRESULT hr; ID3D11Device *device = handle; - mfxVariant impl_value; + mfxVariant impl_value = {0}; hr = ID3D11Device_QueryInterface(device, &IID_IDXGIDevice, (void**)&pDXGIDevice); if (SUCCEEDED(hr)) { @@ -913,7 +913,7 @@ static int qsv_d3d9_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) LUID luid; D3DDEVICE_CREATION_PARAMETERS params; HRESULT hr; - mfxVariant impl_value; + mfxVariant impl_value = {0}; hr = IDirect3DDeviceManager9_OpenDeviceHandle(devmgr, &device_handle); if (FAILED(hr)) { @@ -995,7 +995,7 @@ static int qsv_va_update_config(void *ctx, mfxHDL handle, mfxConfig cfg) VADisplayAttribute attr = { .type = VADisplayPCIID, }; - mfxVariant impl_value; + mfxVariant impl_value = {0}; vas = vaGetDisplayAttributes(dpy, &attr, 1); if (vas == VA_STATUS_SUCCESS && attr.flags != VA_DISPLAY_ATTRIB_NOT_SUPPORTED) { @@ -1036,7 +1036,7 @@ static int qsv_new_mfx_loader(void *ctx, mfxStatus sts; mfxLoader loader = NULL; mfxConfig cfg; - mfxVariant impl_value; + mfxVariant impl_value = {0}; *ploader = NULL; loader = MFXLoad();
Fixes: The warnings from CID1598553 Uninitialized scalar variable Passing partly initialized structs is ugly and asking for hard to reproduce bugs, I do not know if this actually fixes a bug or just avoids the uninitialized fields Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/qsv.c | 2 +- libavutil/hwcontext_qsv.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-)