netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sctp: remove a redundant NULL check
@ 2014-01-13 13:46 Dan Carpenter
  2014-01-13 14:02 ` Neil Horman
  2014-01-15  2:19 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-01-13 13:46 UTC (permalink / raw)
  To: Vlad Yasevich
  Cc: Neil Horman, David S. Miller, linux-sctp, netdev, kernel-janitors

It confuses Smatch when we check "sinit" for NULL and then non-NULL and
that causes a false positive warning later.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index d32dae78a486..27f1717170c2 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1743,7 +1743,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
 		 * either the default or the user specified stream counts.
 		 */
 		if (sinfo) {
-			if (!sinit || (sinit && !sinit->sinit_num_ostreams)) {
+			if (!sinit || !sinit->sinit_num_ostreams) {
 				/* Check against the defaults. */
 				if (sinfo->sinfo_stream >=
 				    sp->initmsg.sinit_num_ostreams) {

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] sctp: remove a redundant NULL check
  2014-01-13 13:46 [PATCH] sctp: remove a redundant NULL check Dan Carpenter
@ 2014-01-13 14:02 ` Neil Horman
  2014-01-15  2:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2014-01-13 14:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Vlad Yasevich, David S. Miller, linux-sctp, netdev,
	kernel-janitors

On Mon, Jan 13, 2014 at 04:46:08PM +0300, Dan Carpenter wrote:
> It confuses Smatch when we check "sinit" for NULL and then non-NULL and
> that causes a false positive warning later.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index d32dae78a486..27f1717170c2 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1743,7 +1743,7 @@ static int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
>  		 * either the default or the user specified stream counts.
>  		 */
>  		if (sinfo) {
> -			if (!sinit || (sinit && !sinit->sinit_num_ostreams)) {
> +			if (!sinit || !sinit->sinit_num_ostreams) {
>  				/* Check against the defaults. */
>  				if (sinfo->sinfo_stream >=
>  				    sp->initmsg.sinit_num_ostreams) {
Acked-by: Neil Horman <nhorman@tuxdriver.com>

> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sctp: remove a redundant NULL check
  2014-01-13 13:46 [PATCH] sctp: remove a redundant NULL check Dan Carpenter
  2014-01-13 14:02 ` Neil Horman
@ 2014-01-15  2:19 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-01-15  2:19 UTC (permalink / raw)
  To: dan.carpenter; +Cc: vyasevich, nhorman, linux-sctp, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 13 Jan 2014 16:46:08 +0300

> It confuses Smatch when we check "sinit" for NULL and then non-NULL and
> that causes a false positive warning later.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-15  2:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13 13:46 [PATCH] sctp: remove a redundant NULL check Dan Carpenter
2014-01-13 14:02 ` Neil Horman
2014-01-15  2:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).