From: Nathan Chancellor <nathan@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev, patches@lists.linux.dev,
kernel test robot <lkp@intel.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Nathan Chancellor <nathan@kernel.org>
Subject: [PATCH] media: dvbdev: Avoid using uninitialized ret in dvb_register_device()
Date: Mon, 21 Oct 2024 09:04:15 -0700 [thread overview]
Message-ID: <20241021-dvbdev-fix-uninitialized-return-v1-1-a704945f20e5@kernel.org> (raw)
When CONFIG_DVB_DYNAMIC_MINORS is not enabled, clang warns (or errors
with CONFIG_WERROR=y):
drivers/media/dvb-core/dvbdev.c:554:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
554 | return ret;
| ^~~
Use the return code -EINVAL directly, like the CONFIG_DVB_DYNAMIC_MINORS
block does.
Fixes: 972e63e895ab ("media: dvbdev: prevent the risk of out of memory access")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410201717.ULWWdJv8-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
drivers/media/dvb-core/dvbdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 14f323fbada719f717fb7fe9f6f2a3ce81e609a3..5bb36be911f615afa1f3a7a13f974b67b3216edd 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -551,7 +551,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
kfree(dvbdev);
*pdvbdev = NULL;
mutex_unlock(&dvbdev_register_lock);
- return ret;
+ return -EINVAL;
}
#endif
dvbdev->minor = minor;
---
base-commit: ba9cf6b430433e57bfc8072364e944b7c0eca2a4
change-id: 20241021-dvbdev-fix-uninitialized-return-6ef4187dfafa
Best regards,
--
Nathan Chancellor <nathan@kernel.org>
next reply other threads:[~2024-10-21 16:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 16:04 Nathan Chancellor [this message]
2024-10-22 14:45 ` [PATCH] media: dvbdev: Avoid using uninitialized ret in dvb_register_device() Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241021-dvbdev-fix-uninitialized-return-v1-1-a704945f20e5@kernel.org \
--to=nathan@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=patches@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox