From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67D95C433E0 for ; Wed, 24 Jun 2020 15:12:23 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1606D2076E for ; Wed, 24 Jun 2020 15:12:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="acWZJh3a"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Ff5473UI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1606D2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Na5mEsbNZa0OsUKM10B7g8+0OrGdspECEVa/BTJdwrM=; b=acWZJh3azwMLJNsHGByAlvYuH hDNkvlmiPLdtn8LK7cfwWFSeZmqFeJKKK9oPhf0x2YU1+G8ajmIgGkTpfiEG/Js8m/ovW0LnCz5Ir mlzBrLOQp9o2jN13tfQIN1HCcfQzsECDJLD4/3UyVsmwAt5dBXJmw1TFX8sWUi5WOuaIeqYlHQcEh wKIbSBXdNsyP7ETQVi6XK67PEFi89CA/CoUDtdgR8k1KgfvacRekqGrrVXTXcH9GI1lQ0HCotblbA GryStYm10WwnkFfyNUCNJ44Sj5uYnnTQ3mqSatNGK+SZtg2iYV/VF7x2A29zsNvzbTRSJ9H5eKs3D iYxDl8SBw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo727-0005gi-VL; Wed, 24 Jun 2020 15:09:52 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo6zi-0004D6-DU for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 15:07:23 +0000 Received: by mail-wr1-x443.google.com with SMTP id h15so2631097wrq.8 for ; Wed, 24 Jun 2020 08:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ka6N3pIS5SMpHS3Dkd8MuBcyOJ38IwtNTJ67x9HE/gM=; b=Ff5473UIxYPsdW4pi6CB5QPFSge/HWs1GPIn1OasdcMvQPjvlEK+g8lSeufiA1UwKm H6KDcmB3IgwAsPz//203sr/5lItNIy2VU8gLEnAju1bDpqSAA+snoMXXBbUKVTtwRhw+ iYvztLUTfNwIJqWObVgXcpCcC997bPMIODvu8fKaIJsBfDZOWCccn9tKIqHndpm41ykY Mq5NnAMV9jctWKT/2bpdtVs0PMXEScf5SNuIIaSmmhtv+vlqdMu/JvyKU4itIlO1CcGf tVbYtwzeO0StF89eiamELfZGSFWzF039y0cQjpkDunjzUqt5nyJcW9aNz0PxKD3gXnrL vAgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ka6N3pIS5SMpHS3Dkd8MuBcyOJ38IwtNTJ67x9HE/gM=; b=Ik5ScPDXnmi6yIe5su63fzb51bR4aVVqMZ1Jo0Z0fZbHbFZmBJ8RgRx2RGRdmyMlSq gU22qL+fwnAsVptu2senG2lwPCI7iIC9JhjvTrVJjXRs5crjshpe4NPpCBgm7dSG1QZu xX7qarB0U6sPtQyRi5NOlRf2qq6sTBwV1SN54TZ+kFotEm0AVPvQtspMDPwI9eeLj/x4 k3nKukeOa+xCloc+ZnFpUquZAyZ8jBjIazCOOJij4kuKub8wmoh65dVdwiadIX2WmFR7 BYl/dpx4JvFoovlygmKTg/WSKGwpkhXG90Yh7kynOs/Nc48oH7n3+gsE7/W9JUmDaHid W+mg== X-Gm-Message-State: AOAM533cqAWrDF1GcFYzEuo0ja5qTKMjmt4U+zNW02kyrWu6gDkD1P1S Jd4ZlP9lLlebH3gfql3U8znUiQ== X-Google-Smtp-Source: ABdhPJzsQZaqGp6yo+Gvy/E7GwTgHGlfZMJUpo8UcdCxDQEq3FwvOrTnZtBe+XexIjSK/+7zMSJxFA== X-Received: by 2002:a5d:6749:: with SMTP id l9mr31134388wrw.63.1593011239284; Wed, 24 Jun 2020 08:07:19 -0700 (PDT) Received: from localhost.localdomain ([2.27.35.144]) by smtp.gmail.com with ESMTPSA id h14sm11543361wrt.36.2020.06.24.08.07.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:07:18 -0700 (PDT) From: Lee Jones To: lee.jones@linaro.org Subject: [PATCH 06/10] mfd: ab3100-core: Fix incompatible types in comparison expression warning Date: Wed, 24 Jun 2020 16:07:00 +0100 Message-Id: <20200624150704.2729736-7-lee.jones@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200624150704.2729736-1-lee.jones@linaro.org> References: <20200624150704.2729736-1-lee.jones@linaro.org> MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@vger.kernel.org, Linus Walleij , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Smatch reports: drivers/mfd/ab3100-core.c:501:20: error: incompatible types in comparison expression (different type sizes): drivers/mfd/ab3100-core.c:501:20: unsigned int * drivers/mfd/ab3100-core.c:501:20: unsigned long * drivers/mfd/ab8500-debugfs.c:1804:20: error: incompatible types in comparison expression (different type sizes): drivers/mfd/ab8500-debugfs.c:1804:20: unsigned int * drivers/mfd/ab8500-debugfs.c:1804:20: unsigned long * Since the second min() argument can be less than 0 a signed variable is required for assignment. However, the non-sized type size_t is passed in from the userspace handlers. In order to firstly compare, then assign the smallest value, we firstly need to cast them both to the same as the receiving size_t typed variable. Cc: Cc: Linus Walleij Signed-off-by: Lee Jones --- drivers/mfd/ab3100-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index 57723f116bb58..ee71ae04b5e63 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c @@ -498,7 +498,7 @@ static ssize_t ab3100_get_set_reg(struct file *file, int i = 0; /* Get userspace string and assure termination */ - buf_size = min(count, (sizeof(buf)-1)); + buf_size = min((ssize_t)count, (ssize_t)(sizeof(buf)-1)); if (copy_from_user(buf, user_buf, buf_size)) return -EFAULT; buf[buf_size] = 0; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel