From patchwork Sun Sep 14 16:02:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 4901601 Return-Path: X-Original-To: patchwork-linux-parisc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 37EEE9F32F for ; Sun, 14 Sep 2014 15:56:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 67B0620220 for ; Sun, 14 Sep 2014 16:00:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8B7DA2016C for ; Sun, 14 Sep 2014 16:00:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752709AbaINQAX (ORCPT ); Sun, 14 Sep 2014 12:00:23 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:51404 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670AbaINQAW (ORCPT ); Sun, 14 Sep 2014 12:00:22 -0400 Received: by mail-lb0-f181.google.com with SMTP id z11so3182502lbi.26 for ; Sun, 14 Sep 2014 09:00:21 -0700 (PDT) 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=tgAiIl/PDCLYhWwpcA2oPXTz6GCJCP24qhfpNEPs0kU=; b=Q0ECy4YH2HHkMhH1ff1i8oBsRj/E0ZBqhhqhSw0kNoA1VTiELMGtoABSQC88MxyrdP VKdh4kQB+YUCSx/QakaCx5BLcgy0l1WxuEUPiNwP5kC0BTT1S0WM0WU1R1xzqok1NaqL 3GyWVwkJNVBKhfUs0Q2X7dPTA/fDTQEKokelxsD6W0UnCOucWcbz61e6GHuMe9QkZ7M2 GWEQPHdxNtQ0XWHhm/RFqr00ZlMZ+6qcrTP2damKbUkScFF9ZsoOQQtB4o0ZD1U3VoHB 4n6vGBG0Bo54MSKxIeElffsSuQSWkQO0R6JehyGejXdHEJUu19e6M4nIQPmw29/wc8/S JJFw== X-Gm-Message-State: ALoCoQmpfCRYB7uAyngWRWZmPObbbjRaEGXaRK2vjECa3+pRwDX+mUteNTMWkXutrv9YPAd481Fm X-Received: by 10.112.148.133 with SMTP id ts5mr21358800lbb.45.1410710421117; Sun, 14 Sep 2014 09:00:21 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id k7sm3198099lak.22.2014.09.14.09.00.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 14 Sep 2014 09:00:20 -0700 (PDT) From: Rickard Strandqvist To: "James E.J. Bottomley" , Helge Deller Cc: Rickard Strandqvist , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] parisc: pdc_stable.c: Cleaning up unnecessary use of memset in conjunction with strncpy Date: Sun, 14 Sep 2014 18:02:12 +0200 Message-Id: <1410710532-14429-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Using memset before strncpy just to ensure a trailing null character is an unnecessary double writing of a string Signed-off-by: Rickard Strandqvist --- drivers/parisc/pdc_stable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/parisc/pdc_stable.c b/drivers/parisc/pdc_stable.c index 0f54ab6..76860ad 100644 --- a/drivers/parisc/pdc_stable.c +++ b/drivers/parisc/pdc_stable.c @@ -765,8 +765,8 @@ static ssize_t pdcs_auto_write(struct kobject *kobj, return -EINVAL; /* We'll use a local copy of buf */ - memset(in, 0, count+1); strncpy(in, buf, count); + in[count] = '\0'; /* Current flags are stored in primary boot path entry */ pathentry = &pdcspath_entry_primary;