From patchwork Thu Nov 27 21:57:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 415645 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A57B314010F for ; Fri, 28 Nov 2014 08:57:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751108AbaK0V5p (ORCPT ); Thu, 27 Nov 2014 16:57:45 -0500 Received: from mail-la0-f54.google.com ([209.85.215.54]:61663 "EHLO mail-la0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750960AbaK0V5o (ORCPT ); Thu, 27 Nov 2014 16:57:44 -0500 Received: by mail-la0-f54.google.com with SMTP id pv20so151328lab.41 for ; Thu, 27 Nov 2014 13:57:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id; bh=xAiqfxo4l0YecC7xwDgLFIcT++rziydgnU5Df9XczOI=; b=XxntEkuhA+OE+EAGYv9WB4xUv0RUH+9/EwGxXN1PCDP9N9C8qbelQFeuM4GN4xp2N0 t/fTPJnEaCLriSXciPiwCcJIq0nc8vQPV2wLKLde3v6sM13Nczdvl/8iX3wUX165zYuz dh3rqRfRmrxlTaqpA6+EDeowWeIhcfZz9hnHI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xAiqfxo4l0YecC7xwDgLFIcT++rziydgnU5Df9XczOI=; b=DEgbmBm7RuVw8fxvhESttCCWrsnNQR0EddWIl2+2E28SOdmJ9ov8rQ4xCqvJIPnWeY k40eINyxqo8BSTz30ht66d7CVbHlcX77PV4s/5LfbfL8Z7bFe1uA3Xn3kYMlK5Kcp2ou C/F/FEao/vFsFAb5DWRgSdw1VVg2z9P9dwJkYJnW4lqNi22CJpIdbsMfdHFWrFHAvXlr fo2kg/EVVcbLEK0tXzN3kT7LPf4Td/HrqYgTVfxgkoSDvRQjUd0VnPGvvJ59I8GCV1XI IG1MmMlf9JVfaKcb6xUwHfK/vjoJ/RmSnM9z0v8Xnqfipmtof1pyRARHnhVb9A+TXhw1 OorA== X-Gm-Message-State: ALoCoQmF3uihqEffBRJkjB7zrrmRT2T9GrsOW1DvCpfVYiU8CMhSgJRu3GpQo2uuMN1USE+wVFAa X-Received: by 10.152.3.229 with SMTP id f5mr39856827laf.94.1417125462953; Thu, 27 Nov 2014 13:57:42 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id a4sm2154450lbi.26.2014.11.27.13.57.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Nov 2014 13:57:42 -0800 (PST) From: Rasmus Villemoes To: "David S. Miller" Cc: Rasmus Villemoes , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] drivers: ide: Fix mostly harmless off-by-one hardcoded value Date: Thu, 27 Nov 2014 22:57:29 +0100 Message-Id: <1417125449-6007-1-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.0.4 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org The string "IOMEGA Clik!" has length 12, not 11. Using strstarts avoids the error-prone hardcoding of the prefix length. For consistency, also change the occurence just above. Signed-off-by: Rasmus Villemoes --- drivers/ide/ide-floppy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 3d42043..8c6363c 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -487,7 +487,7 @@ static void ide_floppy_setup(ide_drive_t *drive) * it. It should be fixed as of version 1.9, but to be on the safe side * we'll leave the limitation below for the 2.2.x tree. */ - if (!strncmp((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI", 20)) { + if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA ZIP 100 ATAPI")) { drive->atapi_flags |= IDE_AFLAG_ZIP_DRIVE; /* This value will be visible in the /proc/ide/hdx/settings */ drive->pc_delay = IDEFLOPPY_PC_DELAY; @@ -498,7 +498,7 @@ static void ide_floppy_setup(ide_drive_t *drive) * Guess what? The IOMEGA Clik! drive also needs the above fix. It makes * nasty clicking noises without it, so please don't remove this. */ - if (strncmp((char *)&id[ATA_ID_PROD], "IOMEGA Clik!", 11) == 0) { + if (strstarts((char *)&id[ATA_ID_PROD], "IOMEGA Clik!")) { blk_queue_max_hw_sectors(drive->queue, 64); drive->atapi_flags |= IDE_AFLAG_CLIK_DRIVE; /* IOMEGA Clik! drives do not support lock/unlock commands */