fix: 内核告警修复
【背景】 经代码扫描工具检测,内核代码中存在 可以修复的告警 【修改方案】 1.将单语句的if, while等加上括号 2.将C语言风格的类型转换变为C++风格 【影响】 对现有的产品编译不会有影响。 Signed-off-by: yinjiaming <yinjiaming@huawei.com> Change-Id: I7d4a04a8904abb3c33e843049bf15f4386d3efd8
This commit is contained in:
@@ -62,8 +62,9 @@ static struct ProcDirEntry g_procRootDirEntry = {
|
||||
|
||||
int ProcMatch(unsigned int len, const char *name, struct ProcDirEntry *pn)
|
||||
{
|
||||
if (len != pn->nameLen)
|
||||
if (len != pn->nameLen) {
|
||||
return 0;
|
||||
}
|
||||
return !strncmp(name, pn->name, len);
|
||||
}
|
||||
|
||||
@@ -387,8 +388,9 @@ static void FreeProcEntry(struct ProcDirEntry *entry)
|
||||
|
||||
void ProcFreeEntry(struct ProcDirEntry *pn)
|
||||
{
|
||||
if (atomic_dec_and_test(&pn->count))
|
||||
if (atomic_dec_and_test(&pn->count)) {
|
||||
FreeProcEntry(pn);
|
||||
}
|
||||
}
|
||||
|
||||
static void RemoveProcEntryTravalsal(struct ProcDirEntry *pn)
|
||||
|
||||
@@ -344,7 +344,7 @@ int osShellCmdMount(int argc, const char **argv)
|
||||
|
||||
filessystemtype = (argc >= 4) ? (char *)argv[3] : NULL; /* 4: specify fs type, 3: fs type */
|
||||
mountfalgs = (argc >= 5) ? get_mountflags((const char *)argv[4]) : 0; /* 4: usr option */
|
||||
data = (argc >= 6) ? (char *)argv[5] : NULL; /* 5: usr option data */
|
||||
data = (argc >= 6) ? (char *)argv[5] : NULL; /* 5: usr option data, 6: six args needed for data */
|
||||
|
||||
if (strcmp(argv[1], "0") == 0) {
|
||||
ret = mount((const char *)NULL, fullpath, filessystemtype, mountfalgs, data);
|
||||
@@ -384,7 +384,7 @@ int osShellCmdMount(int argc, const char **argv)
|
||||
}
|
||||
|
||||
mountfalgs = (argc >= 4) ? get_mountflags((const char *)argv[3]) : 0; /* 3: usr option */
|
||||
data = (argc >= 5) ? (char *)argv[4] : NULL; /* 4: usr option data */
|
||||
data = (argc >= 5) ? (char *)argv[4] : NULL; /* 4: usr option data, 5: number of args needed for data */
|
||||
|
||||
if (strcmp(argv[0], "0") == 0) {
|
||||
ret = mount((const char *)NULL, fullpath, argv[2], mountfalgs, data);
|
||||
|
||||
Reference in New Issue
Block a user