Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1780430imm; Sat, 15 Sep 2018 03:01:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaAk5U9mNhXpnOrGI33jnyIsqao+Rw6dXzh2I/s8YXenEH9R1mFNAqkkqBczUCsMnpy7naR X-Received: by 2002:a63:e4b:: with SMTP id 11-v6mr15592641pgo.320.1537005690162; Sat, 15 Sep 2018 03:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537005690; cv=none; d=google.com; s=arc-20160816; b=eDnWQ2gfxSh7/vogr7nc3PubQCZV/LTj7c1TfyLQSLsOD+KgpjRTrE1YxkMRKjGfFv r0psG61PpVl5Hul0D+GTxuf8Kv2Bvyj/Tyc/PCWEPHraQFDXNCzEUVVGuQcLyr7jfbSi tNhiYF1EB51oULE0q4PhkgaTsZpmgUdg1QIfscEDrH0tspe3XEZ0bSFrXY82KokgkCgI EYYsu/WkT2bJwQjROdHHSmJ5oybVTevmC+xeEzmJ1beblkxute7HiZ3asSYuFUSPZ308 gjLDSuATZukzjPAYzOE8NsQjzO5hjLhqxpUD21Lp7WtfnaZHjKDXU3ZBSh463kCByTE2 0nVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=QmkPg9yNCOMuLquWOsfTrgVlxdHX1vvKrP69lvFmGCA=; b=L8KwFZJQCjKwUWXVER7DYZPgNYYORMYIIef7IQQ8XMLnF3KCHlxeyw0QPZsppxyAB0 aFdfauw+hD45Sc4TUW8lr9PrIQN088S7pDm1EH0JH4ya518MTHM/M57ZOx5r3DgkyE5z ik5JvLECNmIqRGG/fWZMYrespV3O45sOW5x32lWXN2Uccn4Ach+hb/K7pKPW441qv9Ef 98aoewNjfsIYtq+FKL5ceWGR9vajnoe/VBetGoaKfr+8a4s5TxUK/6w6JLPwKPLaO9EL 5tLVvkSDCP2GJz7ZFhHCddXXU2+u7OvaCKTU4glS1HjBbh7DoTyTrMS/htQNz7rXftLz X3tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x3-v6si7920618plr.138.2018.09.15.03.01.14; Sat, 15 Sep 2018 03:01:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727769AbeIOPTP (ORCPT + 99 others); Sat, 15 Sep 2018 11:19:15 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:12147 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727311AbeIOPTP (ORCPT ); Sat, 15 Sep 2018 11:19:15 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C1DB8E36AD85D; Sat, 15 Sep 2018 18:00:46 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Sat, 15 Sep 2018 18:00:41 +0800 From: YueHaibing To: , CC: , , , YueHaibing Subject: [PATCH net-next] net/smc: cast sizeof to int for comparison Date: Sat, 15 Sep 2018 18:00:36 +0800 Message-ID: <20180915100036.20100-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Comparing an int to a size, which is unsigned, causes the int to become unsigned, giving the wrong result. kernel_sendmsg can return a negative error code. Signed-off-by: YueHaibing --- net/smc/smc_clc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 83aba9a..fd0f5ce 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -446,7 +446,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, int smc_type, vec[i++].iov_len = sizeof(trl); /* due to the few bytes needed for clc-handshake this cannot block */ len = kernel_sendmsg(smc->clcsock, &msg, vec, i, plen); - if (len < sizeof(pclc)) { + if (len < (int)sizeof(pclc)) { if (len >= 0) { reason_code = -ENETUNREACH; smc->sk.sk_err = -reason_code; -- 1.8.3.1