Received: by 10.223.185.116 with SMTP id b49csp1029777wrg; Fri, 23 Feb 2018 10:37:38 -0800 (PST) X-Google-Smtp-Source: AH8x227Upr+csT55UZxifWEg9LXTfgc3BlpXAM6tCF2rZJjxZhuI28hEIQSfVeA6210Z7Q76adZN X-Received: by 2002:a17:902:bd04:: with SMTP id p4-v6mr2522899pls.137.1519411058127; Fri, 23 Feb 2018 10:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519411058; cv=none; d=google.com; s=arc-20160816; b=bfSDy4qS+udnIjmuXAYhGR8LQ2LdM3fH+K4QWgd93ne220kSLUi8JxCEevqECHQ1IL W01LkvbY+Q87I2jtr5LHmrRbMs6jrlpLbxxaULzU9eimdWnq70CLdYjJ4xo/T5FUGVTl FrPGZ+G3uM97poG6Z44Vbe7IAoGqT3fhayf+oegqPuV92PemXT1CJ7G9hdtUSqnKlpJ3 wWGYc3beTd2IZ1LNkoRFG8EXipqUjFxrH664hb8foOaeAlrlqViTFL9h4AZ2aIKgrDzh 3rM9LUa2j1xYzPjauXkp+sEt/2Fd8Ti8LeWTx/w6qCZVTo4RbIizW7YXQAGHQytH7Vje 2/oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=FED+d5WRitWbJEeDWcsdbJnYyW7Dj8GsvmUpwD3ohHI=; b=J6a4qXNXYoYY5uhKDnopWL7eNSxfRgIen0/+cMn7y37hrSTcRu0PBpWT2A168byR5Y avxTEvi+fkB/FvmpjZ08I+FJJBmcaIEUhP1moV4AtMLEA+igxjmXqFwkeBwFokIhdIdT ex4GMm4F9+s5t5uknugoBtTI7YwtIypIAvERFNHaUGgS8Y4mGZJbccxDPO2qhVNzMYY+ CO4SgMLEXBM6WEZbBoFXwD7NBzs93jbjkgVUqKAJvwsahsyPTbdACwQV18P3hNWCWTx7 jUv4d5rG4weG/lRdk9uO1baAYiCz1obvpqKtjtncNKSgohPIttjuAv0hv9khkpGFNQDD mvPA== 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 l24si1820131pgo.580.2018.02.23.10.37.23; Fri, 23 Feb 2018 10:37:38 -0800 (PST) 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 S932133AbeBWSgp (ORCPT + 99 others); Fri, 23 Feb 2018 13:36:45 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:37920 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932097AbeBWSgm (ORCPT ); Fri, 23 Feb 2018 13:36:42 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 25092131B; Fri, 23 Feb 2018 18:36:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , NeilBrown Subject: [PATCH 4.4 088/193] md: avoid warning for 32-bit sector_t Date: Fri, 23 Feb 2018 19:25:21 +0100 Message-Id: <20180223170339.819523121@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180223170325.997716448@linuxfoundation.org> References: <20180223170325.997716448@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnd Bergmann commit 3312c951efaba55080958974047414576b9e5d63 upstream. When CONFIG_LBDAF is not set, sector_t is only 32-bits wide, which means we cannot have devices with more than 2TB, and the code that is trying to handle compatibility support for large devices in md version 0.90 is meaningless but also causes a compile-time warning: drivers/md/md.c: In function 'super_90_load': drivers/md/md.c:1029:19: warning: large integer implicitly truncated to unsigned type [-Woverflow] drivers/md/md.c: In function 'super_90_rdev_size_change': drivers/md/md.c:1323:17: warning: large integer implicitly truncated to unsigned type [-Woverflow] This adds a check for CONFIG_LBDAF to avoid even getting into this code path, and also adds an explicit cast to let the compiler know it doesn't have to warn about the truncation. Signed-off-by: Arnd Bergmann Signed-off-by: NeilBrown Signed-off-by: Greg Kroah-Hartman --- drivers/md/md.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1028,8 +1028,9 @@ static int super_90_load(struct md_rdev * (not needed for Linear and RAID0 as metadata doesn't * record this size) */ - if (rdev->sectors >= (2ULL << 32) && sb->level >= 1) - rdev->sectors = (2ULL << 32) - 2; + if (IS_ENABLED(CONFIG_LBDAF) && (u64)rdev->sectors >= (2ULL << 32) && + sb->level >= 1) + rdev->sectors = (sector_t)(2ULL << 32) - 2; if (rdev->sectors < ((sector_t)sb->size) * 2 && sb->level >= 1) /* "this cannot possibly happen" ... */ @@ -1322,8 +1323,9 @@ super_90_rdev_size_change(struct md_rdev /* Limit to 4TB as metadata cannot record more than that. * 4TB == 2^32 KB, or 2*2^32 sectors. */ - if (num_sectors >= (2ULL << 32) && rdev->mddev->level >= 1) - num_sectors = (2ULL << 32) - 2; + if (IS_ENABLED(CONFIG_LBDAF) && (u64)num_sectors >= (2ULL << 32) && + rdev->mddev->level >= 1) + num_sectors = (sector_t)(2ULL << 32) - 2; md_super_write(rdev->mddev, rdev, rdev->sb_start, rdev->sb_size, rdev->sb_page); md_super_wait(rdev->mddev);