mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-22 17:30:40 +03:00
tegra: hwpm: fix null check Coverity defect
Null-checking inode suggests that it may be null, but it has already been dereferenced on path leading to the check. Fix it by adding the null check in correct sequence. CID 10127947 Bug 3461002 Change-Id: Ib9135bdb67c489fa52f5dda6725d3cbd1faddd1e Signed-off-by: Prateek Patel <prpatel@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2645543 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
28bcbc77d2
commit
96db4ef5ab
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -530,7 +530,7 @@ end:
|
||||
static int tegra_soc_hwpm_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int minor = iminor(inode);
|
||||
unsigned int minor;
|
||||
struct tegra_soc_hwpm *hwpm = NULL;
|
||||
u32 i;
|
||||
|
||||
@@ -542,6 +542,8 @@ static int tegra_soc_hwpm_open(struct inode *inode, struct file *filp)
|
||||
tegra_soc_hwpm_err("Invalid file");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
minor = iminor(inode);
|
||||
if (minor > 0) {
|
||||
tegra_soc_hwpm_err("Incorrect minor number");
|
||||
return -EBADFD;
|
||||
|
||||
Reference in New Issue
Block a user