mirror of
git://nv-tegra.nvidia.com/linux-hwpm.git
synced 2025-12-23 01:35:10 +03:00
tegra: hwpm: fix reported coverity violations
- Declare and initialize timeout and mem_bytes_kernel_u32 variables. - alist_map NULL pointer check is done after alist_map structure references. Modify update_allowlist ioctl and release alist_map functions to check alist_map NULL pointer before it's use. - Checking if unsigned _IOC_NR(cmd) is less than zero has no effect. Remove this check. - Correct printf format specifier for mem_bytes_addr. Bug 3461002 Change-Id: I79a97942e667c173d112bcaafb14ddcb8dd7d47f Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2765676 Reviewed-by: Vasuki Shankar <vasukis@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
d58dbfe5a9
commit
14d527e97a
@@ -191,14 +191,11 @@ static int tegra_hwpm_query_allowlist_ioctl(struct tegra_soc_hwpm *hwpm,
|
||||
|
||||
if (query_allowlist->allowlist == NULL) {
|
||||
/* Userspace is querying allowlist size only */
|
||||
if (hwpm->alist_map->full_alist_size == 0) {
|
||||
/*Full alist size is not computed yet */
|
||||
ret = tegra_hwpm_get_allowlist_size(hwpm);
|
||||
if (ret != 0) {
|
||||
tegra_hwpm_err(hwpm,
|
||||
"failed to get alist_size");
|
||||
return ret;
|
||||
}
|
||||
ret = tegra_hwpm_get_allowlist_size(hwpm);
|
||||
if (ret != 0) {
|
||||
tegra_hwpm_err(hwpm,
|
||||
"failed to get alist_size");
|
||||
return ret;
|
||||
}
|
||||
query_allowlist->allowlist_size =
|
||||
hwpm->alist_map->full_alist_size;
|
||||
@@ -248,12 +245,11 @@ static long tegra_hwpm_ioctl(struct file *file,
|
||||
{
|
||||
int ret = 0;
|
||||
struct tegra_soc_hwpm *hwpm = NULL;
|
||||
u8 *buf;
|
||||
u8 *buf = NULL;
|
||||
|
||||
if ((_IOC_TYPE(cmd) != TEGRA_SOC_HWPM_IOC_MAGIC) ||
|
||||
(_IOC_NR(cmd) < 0) ||
|
||||
(_IOC_NR(cmd) >= TERGA_SOC_HWPM_NUM_IOCTLS) ||
|
||||
(_IOC_SIZE(cmd) > TEGRA_SOC_HWPM_MAX_ARG_SIZE)) {
|
||||
(_IOC_NR(cmd) >= TERGA_SOC_HWPM_NUM_IOCTLS) ||
|
||||
(_IOC_SIZE(cmd) > TEGRA_SOC_HWPM_MAX_ARG_SIZE)) {
|
||||
tegra_hwpm_err(hwpm, "Invalid IOCTL call");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
|
||||
Reference in New Issue
Block a user