mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
kernel: nvidia-oot: Fix Linux KMD coverity defects
Fix INT32-C INT32-Cand INT08-C coverity defects for cdi_mgr.c and tegracam_ctrls.c. JIRA CAMERASW-32529 Change-Id: I97f915f94264d78ae8e493874ccf889c9183fc93 Signed-off-by: mijia <mijia@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3314543 Reviewed-by: Sudhir Vyas <svyas@nvidia.com> Reviewed-by: Ankur Pawar <ankurp@nvidia.com> Tested-by: Patrick Young <payoung@nvidia.com> Reviewed-by: Frank Chen <frankc@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Ryan Li <ryanli@nvidia.com>
This commit is contained in:
@@ -1085,6 +1085,7 @@ int tegracam_ctrl_handler_init(struct tegracam_ctrl_handler *handler)
|
|||||||
const struct tegracam_ctrl_ops *ops = handler->ctrl_ops;
|
const struct tegracam_ctrl_ops *ops = handler->ctrl_ops;
|
||||||
const u32 *cids = NULL;
|
const u32 *cids = NULL;
|
||||||
u32 numctrls = 0;
|
u32 numctrls = 0;
|
||||||
|
u32 cid = 0;
|
||||||
u8 compound_control_default_byte_value = 0xff;
|
u8 compound_control_default_byte_value = 0xff;
|
||||||
int i, j;
|
int i, j;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
@@ -1107,7 +1108,15 @@ int tegracam_ctrl_handler_init(struct tegracam_ctrl_handler *handler)
|
|||||||
err = v4l2_ctrl_handler_init(&handler->ctrl_handler, numctrls);
|
err = v4l2_ctrl_handler_init(&handler->ctrl_handler, numctrls);
|
||||||
|
|
||||||
for (i = 0, j = 0; i < numctrls; i++) {
|
for (i = 0, j = 0; i < numctrls; i++) {
|
||||||
u32 cid = i < ops->numctrls ? cids[i] : tegracam_def_cids[j++];
|
if (i < ops->numctrls) {
|
||||||
|
cid = cids[i];
|
||||||
|
} else {
|
||||||
|
cid = tegracam_def_cids[j];
|
||||||
|
if (check_add_overflow(j, 1, &j)) {
|
||||||
|
dev_err(dev, "Error wrapped in loop\n");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
}
|
||||||
int index = tegracam_get_ctrl_index(cid);
|
int index = tegracam_get_ctrl_index(cid);
|
||||||
int size = 0;
|
int size = 0;
|
||||||
if (index >= ARRAY_SIZE(ctrl_cfg_list)) {
|
if (index >= ARRAY_SIZE(ctrl_cfg_list)) {
|
||||||
|
|||||||
@@ -1805,7 +1805,7 @@ static int cdi_mgr_probe(struct platform_device *pdev)
|
|||||||
if (root_node) {
|
if (root_node) {
|
||||||
model = of_get_property(root_node, "model", NULL);
|
model = of_get_property(root_node, "model", NULL);
|
||||||
dev_info(&pdev->dev, "platform name: %s\n", model);
|
dev_info(&pdev->dev, "platform name: %s\n", model);
|
||||||
if (!strcmp(model, "p3898-0010"))
|
if (model != NULL && !strcmp(model, "p3898-0010"))
|
||||||
cdi_mgr->isP3898 = true;
|
cdi_mgr->isP3898 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user