Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp730429img; Wed, 20 Mar 2019 09:38:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzE9fIA36DV8J4V65PcnEip25KDtHlcKdd/OyX6XpIwGEF5Bkhirgb3pWVZWweycoGOQOwy X-Received: by 2002:a63:4e64:: with SMTP id o36mr1546203pgl.213.1553099931806; Wed, 20 Mar 2019 09:38:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553099931; cv=none; d=google.com; s=arc-20160816; b=G/D1+NAUtLJsDibr69LYe7/ifR+rfbhELWCrgU5Nm1r73W/1laS8Lhz1eCF+SXRsla aD+xkDfuja1V6VcSS2q9Y4qzi6yfAXFyrQrFjP3haaNJkct2aqmQSp8UlySxzD/7K3ui rgnAVC8LIgDnXD/Tu0n7D4VmjsUZXdN4ZrM62DbkF8cgOAvnV0A+WWzjgZH8g3dl2K6o R+2j+/INTJNaSOLveWrVyTM6dvKD0CquTUJWtVdyqqCnlj7zl+zXlltPnXpKvnr4SB3C QI/RWdZFs3pfq7fOA/2bInUx5zycCDKOO8oAdSe8EdFD0+n7G1GyQ6+RFAZ1ogcxbTt8 6LAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=dl1abKYLNGV9NdcDdmsiAJurY1c4YIfHkdSG7G22Rgw=; b=W2wMaeoz4SsS/Mnv8Z9EIJnAaMHykZLgFKISIcabSyQRHM8MhTKRC9wSqlDNcIrvRG WTq/nHzMa9dqkXNCKDVx/UTCr1tu34Reqsf8KWhV21TCIbKgZqxWBnArjP9TPUj5LpT+ FrsLA3C2lHC/hBP8bTqXkqU97T8pml0RFfjVo4x0RofHf3Ru6/JqlWo0UnzqU9leR0qP djeKPOvSOunEvlqx+1AXJewDIEajlGit3MvMfkGXjVpy6FnUSkJPFM364x5DcLW0e7P5 trady2Ee1Kh1hX7cAeId0jePgWVsHWwRA0vnasumVzL1sSmBYLvyO7NFJyLKK+kdOIfP nXfw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23si2034111pgb.516.2019.03.20.09.38.36; Wed, 20 Mar 2019 09:38:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727818AbfCTQhM (ORCPT + 99 others); Wed, 20 Mar 2019 12:37:12 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:49745 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726795AbfCTQhL (ORCPT ); Wed, 20 Mar 2019 12:37:11 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1h6eDF-00028h-MH; Wed, 20 Mar 2019 16:37:09 +0000 From: Colin King To: "Martin K . Petersen" , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] scsi: target: fix unsigned comparision with less than zero Date: Wed, 20 Mar 2019 16:37:09 +0000 Message-Id: <20190320163709.28767-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently an error return is being assigned to an unsigned size_t varianle and then checked if the result is less than zero which will always be false. Fix this by making ret ssize_t rather than a size_t. Fixes: 0322913cab79 ("scsi: target: Add device product id and revision configfs attributes") Signed-off-by: Colin Ian King --- drivers/target/target_core_configfs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 8f3faef235b5..3fe79875b3ac 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c @@ -1267,7 +1267,8 @@ static ssize_t target_wwn_vendor_id_store(struct config_item *item, /* +2 to allow for a trailing (stripped) '\n' and null-terminator */ unsigned char buf[INQUIRY_VENDOR_LEN + 2]; char *stripped = NULL; - size_t len, ret; + size_t len; + ssize_t ret; len = strlcpy(buf, page, sizeof(buf)); if (len < sizeof(buf)) { @@ -1322,7 +1323,8 @@ static ssize_t target_wwn_product_id_store(struct config_item *item, /* +2 to allow for a trailing (stripped) '\n' and null-terminator */ unsigned char buf[INQUIRY_MODEL_LEN + 2]; char *stripped = NULL; - size_t len, ret; + size_t len; + ssize_t ret; len = strlcpy(buf, page, sizeof(buf)); if (len < sizeof(buf)) { @@ -1377,7 +1379,8 @@ static ssize_t target_wwn_revision_store(struct config_item *item, /* +2 to allow for a trailing (stripped) '\n' and null-terminator */ unsigned char buf[INQUIRY_REVISION_LEN + 2]; char *stripped = NULL; - size_t len, ret; + size_t len; + ssize_t ret; len = strlcpy(buf, page, sizeof(buf)); if (len < sizeof(buf)) { -- 2.20.1