From: Richard Palethorpe <rpalethorpe@suse.de>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it, Steve Dickson <steved@redhat.com>,
libtirpc-devel@lists.sourceforge.net,
Hongchen Zhang <zhanghongchen@loongson.cn>
Subject: Re: [LTP] [PATCH v2] rpc01: fix variable not initialized
Date: Tue, 11 Oct 2022 09:36:08 +0100 [thread overview]
Message-ID: <87sfju9262.fsf@suse.de> (raw)
In-Reply-To: <Y0Qu7IEihZcYK46i@pevik>
Hello,
Petr Vorel <pvorel@suse.cz> writes:
> Hi Richie,
>
>
>> Hello,
>
>> Looks OK to me, Petr?
>
>> Acked-by: Richard Palethorpe <rpalethorpe@suse.com>
>
> I replied at ML at v1 [1] with a question to use rc for verification.
> I'm not sure whether it was me who marked the question as superseded.
Probably me.
>
> @Hongchen you sent v1 twice, v2 twice. Duplicate send without your reply does
> not speedup things. Please next time reply with ping (but if you don't reply to
> the question, ball is on your side).
I'll mark this as changes requested.
TBH I think the test needs rewriting in the new API in pure C. So this
is likely to be wasted effort.
>
> Kind regards,
> Petr
>
> [1] https://lore.kernel.org/ltp/Ysu+mbkO8eUP4A2+@pevik/
> [2] https://patchwork.ozlabs.org/project/ltp/list/?submitter=84160&state=*
>
>> Hongchen Zhang <zhanghongchen@loongson.cn> writes:
>
>> > when error occurred in function callrpc/clnt_call, return_buffer may
>> > be leaved not initialized.
>> > As Petr said, we should check the return value before retrieve the
>> > return_buffer->data. Change do_compare's parameter from char * to
>> > struct data * to fix it.
>
>> > Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
>> > ---
>> > testcases/network/rpc/basic_tests/rpc01/rpc1.c | 14 ++++++++------
>> > 1 file changed, 8 insertions(+), 6 deletions(-)
>
>> > diff --git a/testcases/network/rpc/basic_tests/rpc01/rpc1.c b/testcases/network/rpc/basic_tests/rpc01/rpc1.c
>> > index bc9f35b..6b8619d 100644
>> > --- a/testcases/network/rpc/basic_tests/rpc01/rpc1.c
>> > +++ b/testcases/network/rpc/basic_tests/rpc01/rpc1.c
>> > @@ -18,7 +18,8 @@ char *file_name = NULL;
>> > char host_name[100];
>> > long host_address;
>
>> > -void do_compare(int, char *, struct data *, char *);
>> > +void do_compare(int rpc_rc, char *msg, struct data *buffer,
>> > + struct data *ret_buffer)
>> > void usage_error(char *program_name);
>
>> > int main(int argc, char *argv[])
>> > @@ -128,7 +129,7 @@ int main(int argc, char *argv[])
>> > rc = callrpc(server, program, version, 1, (xdrproc_t)xdr_send_data,
>> > (char *)&buffer, (xdrproc_t)xdr_receive_data,
>> > (char *)&return_buffer);
>> > - do_compare(rc, "callrpc", &buffer, return_buffer->data);
>> > + do_compare(rc, "callrpc", &buffer, return_buffer);
>
>> > server_sin.sin_port = 0;
>> > sock = RPC_ANYSOCK;
>> > @@ -145,7 +146,7 @@ int main(int argc, char *argv[])
>> > (char *)&buffer, (xdrproc_t)xdr_receive_data,
>> > (char *)&return_buffer, timeout);
>> > clnt_destroy(clnt);
>> > - do_compare(rc, "udp transport", &buffer, return_buffer->data);
>> > + do_compare(rc, "udp transport", &buffer, return_buffer);
>
>> > server_sin.sin_port = 0;
>> > sock = RPC_ANYSOCK;
>> > @@ -160,12 +161,13 @@ int main(int argc, char *argv[])
>> > (char *)&buffer, (xdrproc_t)xdr_receive_data,
>> > (char *)&return_buffer, timeout);
>> > clnt_destroy(clnt);
>> > - do_compare(rc, "tcp transport", &buffer, return_buffer->data);
>> > + do_compare(rc, "tcp transport", &buffer, return_buffer);
>
>> > exit(0);
>> > }
>
>> > -void do_compare(int rpc_rc, char *msg, struct data *buffer, char *ret_data)
>> > +void do_compare(int rpc_rc, char *msg, struct data *buffer,
>> > + struct data *ret_buffer)
>> > {
>> > int rc;
>
>> > @@ -175,7 +177,7 @@ void do_compare(int rpc_rc, char *msg, struct data *buffer, char *ret_data)
>> > printf("\n");
>> > exit(1);
>> > }
>> > - rc = memcmp(buffer->data, ret_data, buffer->data_length);
>> > + rc = memcmp(buffer->data, ret_buffer->data, buffer->data_length);
>> > if (rc) {
>> > printf("Data compare for %s returned %d\n", msg, rc);
>> > exit(1);
>> > --
>> > 1.8.3.1
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2022-10-11 8:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 12:17 [LTP] [PATCH] rpc01: fix variable not initialized Hongchen Zhang
2022-07-11 6:09 ` Petr Vorel
2022-07-12 6:43 ` [LTP] [PATCH v2] " Hongchen Zhang
2022-10-10 13:23 ` Richard Palethorpe
2022-10-10 14:40 ` Petr Vorel
2022-10-11 8:36 ` Richard Palethorpe [this message]
2022-10-11 8:50 ` Petr Vorel
2022-07-12 6:46 ` Hongchen Zhang
2022-07-12 7:01 ` [LTP] [PATCH] " Hongchen Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sfju9262.fsf@suse.de \
--to=rpalethorpe@suse.de \
--cc=libtirpc-devel@lists.sourceforge.net \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=steved@redhat.com \
--cc=zhanghongchen@loongson.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox