From 440af660ff83271acc747cfc2482c38c88beb59c Mon Sep 17 00:00:00 2001 From: Xiaoyun Li Date: Mon, 5 Aug 2019 13:57:28 +0800 Subject: [PATCH] examples/ntb: fix error handling This patch adds return value checking for fseek function to fix error handling issue found by coverity scan. Coverity issue: 344996 Fixes: c5eebf85badc ("examples/ntb: add example for NTB") Cc: stable@dpdk.org Signed-off-by: Xiaoyun Li Reviewed-by: Xiaolong Ye --- examples/ntb/ntb_fwd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c index c169f01a3d..f8c970cdb8 100644 --- a/examples/ntb/ntb_fwd.c +++ b/examples/ntb/ntb_fwd.c @@ -125,9 +125,15 @@ cmd_sendfile_parsed(void *parsed_result, return; } - fseek(file, 0, SEEK_END); + if (fseek(file, 0, SEEK_END) < 0) { + printf("Fail to get file size.\n"); + return; + } size = ftell(file); - fseek(file, 0, SEEK_SET); + if (fseek(file, 0, SEEK_SET) < 0) { + printf("Fail to get file size.\n"); + return; + } /** * No FIFO now. Only test memory. Limit sending file -- 2.20.1