Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bf8152a authored by Kumar Anurag Singh's avatar Kumar Anurag Singh
Browse files

audio-HAL: Fix for KW static analysis issues



- Add unlock for variable before exiting the method.
- Fix issue for Buffer Overflow - Non-null Terminated String.

Change-Id: Ied74e21de3a126d506fde1a05042af84c0211239
Signed-off-by: default avatarKumar Anurag Singh <quic_kumaranu@quicinc.com>
parent b9031253
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@
/*
* Changes from Qualcomm Innovation Center are provided under the following license:
*
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the
@@ -1370,8 +1370,10 @@ static void* spkr_calibration_thread()
                        }
                       thermal_fd = open(wsa_path, O_RDONLY);
                       if (thermal_fd > 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                               buf[ret-1] = '\0';
                               t0_spk_1 = atoi(buf);
                           }
                           else
                               ALOGE("%s: read fail for %s err:%d\n",
                                     __func__, wsa_path, ret);
@@ -1404,8 +1406,10 @@ static void* spkr_calibration_thread()
                        }
                        thermal_fd = open(wsa_path, O_RDONLY);
                        if (thermal_fd > 0) {
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0)
                           if ((ret = read(thermal_fd, buf, sizeof(buf))) >= 0) {
                               buf[ret-1] = '\0';
                               t0_spk_2 = atoi(buf);
                           }
                           else
                               ALOGE("%s: read fail for %s err:%d\n",
                                     __func__, wsa_path, ret);
+2 −1
Original line number Diff line number Diff line
@@ -902,7 +902,8 @@ int effect_command(effect_handle_t self, uint32_t cmdCode, uint32_t cmdSize,
        }
        if (pCmdData == NULL || cmdSize != 2 * sizeof(uint32_t) ||
                replySize == NULL || *replySize < 2*sizeof(int32_t)) {
            return -EINVAL;
            status = -EINVAL;
            goto exit;
        }
        memcpy(pReplyData, pCmdData, sizeof(int32_t)*2);
        } break;