[2/2] ARC: show_faulting_vma: check file_path for error

Message ID 20180806164424.32439-2-Eugeniy.Paltsev@synopsys.com
State New
Headers show
Series
  • [1/2] ARC: show_faulting_vma: remove unused variables
Related show

Commit Message

Eugeniy Paltsev Aug. 6, 2018, 4:44 p.m.
Return value of file_path() should be validated with
IS_ERR() macro.

Generic print_vma_addr() implementation was used as an example.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 arch/arc/kernel/troubleshoot.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/arch/arc/kernel/troubleshoot.c b/arch/arc/kernel/troubleshoot.c
index f7330a3a1c4d..e8d9fb452346 100644
--- a/arch/arc/kernel/troubleshoot.c
+++ b/arch/arc/kernel/troubleshoot.c
@@ -98,6 +98,8 @@  static void show_faulting_vma(unsigned long address, char *buf)
 	if (vma && (vma->vm_start <= address)) {
 		if (vma->vm_file) {
 			nm = file_path(vma->vm_file, buf, PAGE_SIZE - 1);
+			if (IS_ERR(nm))
+				nm = "?";
 		}
 		pr_info("    @off 0x%lx in [%s]\n"
 			"    VMA: 0x%08lx to 0x%08lx\n",