Skip to contentSkip to conversation

fix rpc_suite/rpc:add check returned value

PATCH James Dong (董世江) 1 participant 1 message Jun 24, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Petr

My test environment is centos8.2, kernel version is 4.18 (CentOS-8.2.2004-x86_64-dvd1.iso) For example:

	svcr = svcfd_create(fd, 0, 0);
	//Then call destroy macro
	svc_destroy(svcr);

If "svcfd_create" fails, that is, the return value is NULL and then call "svc_destroy" will report an error "Segmentation fault"

Kind regards,
Dong

-----????-----
???: Petr Vorel [mailto:[email protected]]
????: 2021?6?24? 0:07
???: James Dong (???) <[email protected]>
??: [email protected]; Alexey Kodanev <[email protected]>; Steve Dickson <[email protected]>; [email protected]; [email protected] ??: Re: [LTP] [PATCH] fix rpc_suite/rpc:add check returned value

Hi Dong,

Quoted 2 lines

Hi Petr
I think this is just a simple test of some APIs, but some test cases are not standardized and cause errors like "Segmentation fault" during testing. I think it is necessary to fix these errors or delete these tests.

Sure this fix can get in. I saw issues with some tests on openSUSE, but that's a separate problem (I was not able to find the problem thus report it.

Quoted 7 lines

Kind regards,
Dong

Quoted 3 lines

+++ b/testcases/network/rpc/rpc-tirpc/tests_pack/rpc_suite/rpc/rpc_c +++ reatedestroy_svc_destroy/rpc_svc_destroy.c

(quoted diff) +0 -0
@@ -46,6 +46,11 @@ int main(void)
Quoted 5 lines

Review int main(void) · line 50

Quoted 5 lines
(quoted diff) +3 -0
 	//First of all, create a server
 	svcr = svcfd_create(fd, 0, 0);
+
+	//check returned value
+	if ((SVCXPRT *) svcr == NULL) {

IMHO casting is not required, right? Just

	if (svcr == NULL) {

Kind regards,
Petr