* [PATCH] Remove some unnecessary checks on socket restart
@ 2009-10-01 21:40 Dan Smith
[not found] ` <1254433228-20882-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Dan Smith @ 2009-10-01 21:40 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg
These two checks are removed because they cannot be true because of the
unsigned nature of the values being examined
Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
Cc: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
Cc: orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org
---
net/checkpoint.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/checkpoint.c b/net/checkpoint.c
index a11ec7a..017c7f8 100644
--- a/net/checkpoint.c
+++ b/net/checkpoint.c
@@ -480,12 +480,10 @@ static int sock_cptrst(struct ckpt_ctx *ctx, struct sock *sk,
ckpt_debug("socket/sock in inconsistent state: %i/%i",
h->socket.state, h->sock.state);
return -EINVAL;
- } else if ((h->sock.state < TCP_ESTABLISHED) ||
- (h->sock.state >= TCP_MAX_STATES)) {
+ } else if (h->sock.state >= TCP_MAX_STATES) {
ckpt_debug("sock in invalid state: %i", h->sock.state);
return -EINVAL;
- } else if ((h->socket.state < SS_FREE) ||
- (h->socket.state > SS_DISCONNECTING)) {
+ } else if (h->socket.state > SS_DISCONNECTING) {
ckpt_debug("socket in invalid state: %i",
h->socket.state);
return -EINVAL;
--
1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Remove some unnecessary checks on socket restart
[not found] ` <1254433228-20882-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-10-01 21:47 ` Serge E. Hallyn
[not found] ` <20091001214749.GA4343-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Serge E. Hallyn @ 2009-10-01 21:47 UTC (permalink / raw)
To: Dan Smith; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
Quoting Dan Smith (danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org):
> These two checks are removed because they cannot be true because of the
> unsigned nature of the values being examined
>
> Signed-off-by: Dan Smith <danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> Cc: serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
> Cc: orenl-RdfvBDnrOixBDgjK7y7TUQ@public.gmane.org
> ---
> net/checkpoint.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/net/checkpoint.c b/net/checkpoint.c
> index a11ec7a..017c7f8 100644
> --- a/net/checkpoint.c
> +++ b/net/checkpoint.c
> @@ -480,12 +480,10 @@ static int sock_cptrst(struct ckpt_ctx *ctx, struct sock *sk,
> ckpt_debug("socket/sock in inconsistent state: %i/%i",
> h->socket.state, h->sock.state);
> return -EINVAL;
> - } else if ((h->sock.state < TCP_ESTABLISHED) ||
> - (h->sock.state >= TCP_MAX_STATES)) {
> + } else if (h->sock.state >= TCP_MAX_STATES) {
No, TCP_ESTABLISHED is defined to 1 isn't it?
> ckpt_debug("sock in invalid state: %i", h->sock.state);
> return -EINVAL;
> - } else if ((h->socket.state < SS_FREE) ||
> - (h->socket.state > SS_DISCONNECTING)) {
> + } else if (h->socket.state > SS_DISCONNECTING) {
Yes, thanks.
> ckpt_debug("socket in invalid state: %i",
> h->socket.state);
> return -EINVAL;
> --
> 1.6.0.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Remove some unnecessary checks on socket restart
[not found] ` <20091001214749.GA4343-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-10-01 22:01 ` Dan Smith
0 siblings, 0 replies; 3+ messages in thread
From: Dan Smith @ 2009-10-01 22:01 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: containers-qjLDD68F18O7TbgM5vRIOg
SH> No, TCP_ESTABLISHED is defined to 1 isn't it?
Argh. Yes, it is, even though it's the first one in the enum. How
annoying.
--
Dan Smith
IBM Linux Technology Center
email: danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-10-01 22:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-01 21:40 [PATCH] Remove some unnecessary checks on socket restart Dan Smith
[not found] ` <1254433228-20882-1-git-send-email-danms-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-01 21:47 ` Serge E. Hallyn
[not found] ` <20091001214749.GA4343-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-10-01 22:01 ` Dan Smith
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.