fix: 内核告警修复

【背景】
内核代码经代码扫描工具发现存在一些关于代码格式的告警,
现经修改解除掉告警。

【修改方案】
修改了代码中格式不规范的地方,修改的点有:
1.代码中一行过长
2.没有合理的添加空格和空行
3.没有按照规范进行缩进
4.括号的格式没有按照规范
5.注释的格式不对以及存在魔数字
6.函数的声明与定义的格式不一致
并更新了修改文件的版权头时间

【影响】
对现有的产品编译不会有影响。

re #I5H6F5
Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Id8eb0450d03fae537ea4c73190fdadb76b29253d
This commit is contained in:
yinjiaming
2022-07-20 09:42:09 +00:00
parent e1f986305b
commit a36d5d9058
24 changed files with 95 additions and 86 deletions
+22 -22
View File
@@ -29,7 +29,7 @@ g_row_num = 0
try:
from openpyxl import Workbook
except:
print ("excel output is not support, need install openpyxl")
print("excel output is not support, need install openpyxl")
else:
g_excel_support = True
@@ -60,21 +60,21 @@ def store_static_excel():
wb = Workbook()
ws = wb.active
for base_address, values in static_map.items():
c = ws.cell(row = base_address + 1, column = 1)
c = ws.cell(row=base_address + 1, column=1)
c.value = values.get('offsets')
c = ws.cell(row = base_address + 1, column = 2)
c = ws.cell(row=base_address + 1, column=2)
c.value = values.get('section')
c = ws.cell(row = base_address + 1, column = 3)
c = ws.cell(row=base_address + 1, column=3)
c.value = values.get('sizeH')
c = ws.cell(row = base_address + 1, column = 4)
c = ws.cell(row=base_address + 1, column=4)
c.value = values.get('sizeD')
c = ws.cell(row = base_address + 1, column = 5)
c = ws.cell(row=base_address + 1, column=5)
c.value = values.get('symbol')
c = ws.cell(row = base_address + 1, column = 6)
c = ws.cell(row=base_address + 1, column=6)
c.value = values.get('lib')
c = ws.cell(row = base_address + 1, column = 7)
c = ws.cell(row=base_address + 1, column=7)
c.value = values.get('obj')
wb.save('static_symbol-%s.xlsx' %datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S'))
wb.save('static_symbol-%s.xlsx' % datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S'))
return
def format_store_static():
@@ -152,7 +152,7 @@ def store_dync_excel():
c = ws.cell(row, column + 3)
c.value = values.get('lib')
column = column + 3
wb.save('dync_mem-%s.xlsx' %datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S'))
wb.save('dync_mem-%s.xlsx' % datetime.datetime.now().strftime('%Y-%m-%d %H_%M_%S'))
return
def format_store_dync():
@@ -296,7 +296,7 @@ def parse_log(log_path):
get_valid_log = False
for index, line in enumerate(logline):
char_list = line.split()
if len (char_list) < 3:
if len(char_list) < 3:
continue
if ("node" == char_list[0]) & ("LR[0]" == char_list[2]):
storage_dync_head(len(char_list) - 2)
@@ -318,34 +318,34 @@ def parse_log(log_path):
continue
def main():
print ("memory parses tool ver.%2f\r\n" %g_version)
print("memory parses tool ver.%2f\r\n" % g_version)
parser = argparse.ArgumentParser()
parser.add_argument('--m', help = 'map path.')
parser.add_argument('--l', help = 'dynamic mem log path.')
parser.add_argument('--d', help = 'objdump path.')
parser.add_argument('--m', help='map path.')
parser.add_argument('--l', help='dynamic mem log path.')
parser.add_argument('--d', help='objdump path.')
args = parser.parse_args()
print ("map path: %s\r\n" %args.m)
print("map path: %s\r\n" % args.m)
if args.m == None :
print ("arg error, input -h get the help list\r\n")
print("arg error, input -h get the help list\r\n")
return
parse_map(args.m)
print ("dump path: %s" %args.d)
print("dump path: %s" % args.d)
if args.d != None :
parse_dump(args.d)
format_store_static()
else:
print ("dump path unspecified, will not be static parser")
print ("you can enter the objdump -t command under the linux shell to obtain dump information\r\n")
print("dump path unspecified, will not be static parser")
print("you can enter the objdump -t command under the linux shell to obtain dump information\r\n")
print ("log path: %s" %args.l)
print("log path: %s" % args.l)
if args.l != None :
parse_log(args.l)
format_store_dync()
else:
print ("log path unspecified, will not be dynamic parser\r\n")
print("log path unspecified, will not be dynamic parser\r\n")
return