* [LTP] [PATCH] lib: fix length check in safe_sendmsg
@ 2018-03-14 10:40 Richard Palethorpe
2018-03-14 11:25 ` Alexey Kodanev
0 siblings, 1 reply; 2+ messages in thread
From: Richard Palethorpe @ 2018-03-14 10:40 UTC (permalink / raw)
To: ltp
It appears that we only check the len parameter against the return value if
the len parameter is zero.
Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
---
lib/safe_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/safe_net.c b/lib/safe_net.c
index 9ea9d2b42..96216ee69 100644
--- a/lib/safe_net.c
+++ b/lib/safe_net.c
@@ -200,7 +200,7 @@ ssize_t safe_sendmsg(const char *file, const int lineno, size_t len,
file, lineno, sockfd, msg, flags);
}
- if (!len && (size_t)rval != len) {
+ if (len && (size_t)rval != len) {
tst_brkm(TBROK, NULL,
"%s:%d: sendmsg(%d, %p, %d) ret(%zd) != len(%zu)",
file, lineno, sockfd, msg, flags, rval, len);
--
2.16.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH] lib: fix length check in safe_sendmsg
2018-03-14 10:40 [LTP] [PATCH] lib: fix length check in safe_sendmsg Richard Palethorpe
@ 2018-03-14 11:25 ` Alexey Kodanev
0 siblings, 0 replies; 2+ messages in thread
From: Alexey Kodanev @ 2018-03-14 11:25 UTC (permalink / raw)
To: ltp
On 03/14/2018 01:40 PM, Richard Palethorpe wrote:
> It appears that we only check the len parameter against the return value if
> the len parameter is zero.
>
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> ---
> lib/safe_net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/safe_net.c b/lib/safe_net.c
> index 9ea9d2b42..96216ee69 100644
> --- a/lib/safe_net.c
> +++ b/lib/safe_net.c
> @@ -200,7 +200,7 @@ ssize_t safe_sendmsg(const char *file, const int lineno, size_t len,
> file, lineno, sockfd, msg, flags);
> }
>
> - if (!len && (size_t)rval != len) {
> + if (len && (size_t)rval != len) {
> tst_brkm(TBROK, NULL,
> "%s:%d: sendmsg(%d, %p, %d) ret(%zd) != len(%zu)",
> file, lineno, sockfd, msg, flags, rval, len);
>
Applied. Nice catch, thank you Richard!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-14 11:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 10:40 [LTP] [PATCH] lib: fix length check in safe_sendmsg Richard Palethorpe
2018-03-14 11:25 ` Alexey Kodanev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.