From patchwork Thu Nov 26 18:22:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 7708441 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EC6449F1D3 for ; Thu, 26 Nov 2015 18:22:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32D15205F0 for ; Thu, 26 Nov 2015 18:22:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 024F4205DD for ; Thu, 26 Nov 2015 18:22:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753309AbbKZSWz (ORCPT ); Thu, 26 Nov 2015 13:22:55 -0500 Received: from mga01.intel.com ([192.55.52.88]:52433 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753276AbbKZSWy (ORCPT ); Thu, 26 Nov 2015 13:22:54 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 26 Nov 2015 10:22:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,347,1444719600"; d="scan'208";a="829690624" Received: from black.fi.intel.com ([10.237.72.93]) by orsmga001.jf.intel.com with ESMTP; 26 Nov 2015 10:22:52 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 04D3C102; Thu, 26 Nov 2015 20:22:51 +0200 (EET) From: Andy Shevchenko To: linux-scsi@vger.kernel.org, Douglas Gilbert , "Martin K . Petersen" , "James E.J. Bottomley" Cc: Andy Shevchenko Subject: [PATCH v1 1/1] scsi_debug: check for bigger value first Date: Thu, 26 Nov 2015 20:22:50 +0200 Message-Id: <1448562170-122075-1-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.6.2 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Andy Shevchenko Even for signed types we have to check for bigger positive value first. Otherwise it will be never happened. Acked-by: Douglas Gilbert Signed-off-by: Andy Shevchenko Reviewed-by: Johannes Thumshirn Reviewed-by: Ewan D. Milne --- drivers/scsi/scsi_debug.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index dfcc45b..f773b34 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -4846,10 +4846,10 @@ static int __init scsi_debug_init(void) /* play around with geometry, don't waste too much on track 0 */ sdebug_heads = 8; sdebug_sectors_per = 32; - if (scsi_debug_dev_size_mb >= 16) - sdebug_heads = 32; - else if (scsi_debug_dev_size_mb >= 256) + if (scsi_debug_dev_size_mb >= 256) sdebug_heads = 64; + else if (scsi_debug_dev_size_mb >= 16) + sdebug_heads = 32; sdebug_cylinders_per = (unsigned long)sdebug_capacity / (sdebug_sectors_per * sdebug_heads); if (sdebug_cylinders_per >= 1024) {