提交 8ea2d73f 编写于 作者: J Jialin Zhang 提交者: Zheng Zengkai

kabi: fix split error of kABI reference checking tool

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4JZ0H
CVE: NA

-------------------------------

Use the kABI reference checking tool as follows:

  ./scripts/check-kabi -k Module.symvers.baseline -s Module.symvers

A python error occurred, and the following traceback is printed:

Traceback (most recent call last):
  File "./scripts/check-kabi", line 144, in <module>
    load_symvers(symvers,symvers_file)
  File "./scripts/check-kabi", line 45, in load_symvers
    checksum,symbol,directory,type = string.split(in_line)
ValueError: too many values to unpack

It is because the Module.symvers file change its line format in
the following commits, and the namespace field may be empty:
cb9b55d2 ("modpost: add support for symbol namespaces")
5190044c ("modpost: move the namespace field in Module.symvers last")

In order to solve this problem, use '\t' to split each line and
add a variable to save namespace.

Fixes: 9fc7fbaf ("kabi: add kABI reference checking tool")
Signed-off-by: NJialin Zhang <zhangjialin11@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 e69ae850
...@@ -42,7 +42,7 @@ def load_symvers(symvers,filename): ...@@ -42,7 +42,7 @@ def load_symvers(symvers,filename):
break break
if in_line == "\n": if in_line == "\n":
continue continue
checksum,symbol,directory,type = string.split(in_line) checksum,symbol,directory,type,namespace = string.split(in_line, sep='\t')
symvers[symbol] = in_line[0:-1] symvers[symbol] = in_line[0:-1]
...@@ -57,7 +57,7 @@ def load_kabi(kabi,filename): ...@@ -57,7 +57,7 @@ def load_kabi(kabi,filename):
break break
if in_line == "\n": if in_line == "\n":
continue continue
checksum,symbol,directory,type = string.split(in_line) checksum,symbol,directory,type,namespace = string.split(in_line, sep='\t')
kabi[symbol] = in_line[0:-1] kabi[symbol] = in_line[0:-1]
...@@ -70,9 +70,9 @@ def check_kabi(symvers,kabi): ...@@ -70,9 +70,9 @@ def check_kabi(symvers,kabi):
moved_symbols=[] moved_symbols=[]
for symbol in kabi: for symbol in kabi:
abi_hash,abi_sym,abi_dir,abi_type = string.split(kabi[symbol]) abi_hash,abi_sym,abi_dir,abi_type,namespace = string.split(kabi[symbol], sep='\t')
if symvers.has_key(symbol): if symvers.has_key(symbol):
sym_hash,sym_sym,sym_dir,sym_type = string.split(symvers[symbol]) sym_hash,sym_sym,sym_dir,sym_type,namespace = string.split(symvers[symbol], sep='\t')
if abi_hash != sym_hash: if abi_hash != sym_hash:
fail=1 fail=1
changed_symbols.append(symbol) changed_symbols.append(symbol)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册