Fix SVACE warnings 67/161667/5
authorIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Fri, 24 Nov 2017 12:41:50 +0000 (13:41 +0100)
committerIgor Kotrasinski <i.kotrasinsk@partner.samsung.com>
Tue, 28 Nov 2017 14:06:57 +0000 (15:06 +0100)
Change-Id: I85a015621302baac06e48cc0cffd5e2390495bf5
Signed-off-by: Igor Kotrasinski <i.kotrasinsk@partner.samsung.com>
TEECLib/src/teec_api.c
ssflib/dep/swdss/include/file_op.h
ssflib/dep/swdss/source/file_op.cpp
ssflib/dep/swdss/source/secure_file.cpp

index d1f68c813dd2869ac0f3f534b6624bf9caa3154f..a23aa71cb5a3e17fe2cb0333fbce189db509e7bc 100644 (file)
@@ -272,6 +272,8 @@ TEEC_Result tempSharedMemAllocate(TEEC_SharedMemory** tmpSharedMem, uint32_t typ
 {
        TEEC_Result result;
        *tmpSharedMem = (TEEC_SharedMemory *)OsaMalloc(sizeof(TEEC_SharedMemory));
+       if (!*tmpSharedMem)
+               return TEEC_ERROR_OUT_OF_MEMORY;
        (*tmpSharedMem)->size = param.tmpref.size;
        (*tmpSharedMem)->buffer = param.tmpref.buffer;
 
@@ -413,10 +415,7 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                case TEEC_MEMREF_PARTIAL_INPUT:
                case TEEC_MEMREF_PARTIAL_OUTPUT:
                case TEEC_MEMREF_PARTIAL_INOUT:
-                       op->paramTypes |= ((operation->params[i].memref.parent->flags & type) |
-                                                               (TEE_PARAM_TYPE_MEMREF_INPUT & TEE_PARAM_TYPE_MEMREF_OUTPUT)) << (8 * i);
                        memref = &operation->params[i].memref;
-
                        if ((NULL == memref) || (NULL == memref->parent)
                                        || (((TEEC_SharedMemoryImp *)memref->parent->imp)->context->imp
                                                != context->imp)) {
@@ -425,6 +424,8 @@ static TEEC_Result preProcessOperation(TEEC_Session *session,
                                goto cleanup;
                        }
 
+                       op->paramTypes |= ((operation->params[i].memref.parent->flags & type) |
+                                                               (TEE_PARAM_TYPE_MEMREF_INPUT & TEE_PARAM_TYPE_MEMREF_OUTPUT)) << (8 * i);
                        memref_imp = (TEEC_SharedMemoryImp *)memref->parent->imp;
                        op->params[i].mem.size = memref->size;
                        op->params[i].mem.offset = memref->offset;
index 0e45b69d8720409205421474fef6f3a6f32a0214..71df04425a21e3b22be1ae70b7368265149bc682 100644 (file)
@@ -25,6 +25,8 @@
 #define CURRENT_DIR "."
 #define PARENT_DIR ".."
 
+#define MAX_FILENAME_LEN 256
+
 class file_op {
 public:
 
index 9e1350b38d6097ef775d3500ac513f36f7a15c4b..9b248d15143a6f0d69ba05c88f549454f3d3d3a6 100644 (file)
@@ -49,7 +49,7 @@ int file_op::write_file(const char* filename, unsigned char* buffer,
        }
 
        // create folder if not exist.
-       char base_path[255] = {0};
+       char base_path[MAX_FILENAME_LEN] = {0};
        get_base_path(filename, base_path);
        SLOGI("base_path %s.", base_path);
        if (!is_folder_exists(base_path)) {
@@ -175,7 +175,7 @@ int file_op::is_valid_filename(const char* filename) {
 int file_op::create_folder(const char* folder) {
        SLOGI("[%s][%d] START", __FUNCTION__, __LINE__);
 
-       char base_p[256] = {0};
+       char base_p[MAX_FILENAME_LEN] = {0};
        get_base_path(folder, base_p);
        if (!is_folder_exists(base_p)) {
                if (0 != create_folder(base_p)) {
index 8a0700ab8a94d5488dc6fd30d9bd1833e1b565c2..4bf131f5b2783bd2ed822edef239af65cb02775e 100644 (file)
@@ -28,8 +28,6 @@
 
 #endif
 
-#define MAX_FILENAME_LEN 256
-
 // this is RNG SEED for mask
 static const CBT_UINT32 RNG_SEED = 0xa3e59cf2;
 // this is RNG SEED for mask