From patchwork Sat Oct 18 22:17:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 5100371 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C9E04C11AC for ; Sat, 18 Oct 2014 22:15:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8A4522018E for ; Sat, 18 Oct 2014 22:15:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B79B720176 for ; Sat, 18 Oct 2014 22:15:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbaJRWO6 (ORCPT ); Sat, 18 Oct 2014 18:14:58 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:43092 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751250AbaJRWO5 (ORCPT ); Sat, 18 Oct 2014 18:14:57 -0400 Received: by mail-la0-f44.google.com with SMTP id hs14so2258461lab.31 for ; Sat, 18 Oct 2014 15:14:55 -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=ZT87JQQ1byBvQQPC6as2u8YmswxYEwF9zrjyyr2bRtY=; b=LtecT184etITEhJp0KeHQOFE2T4TBGfJiMoptBbjVcjX1r7FjS+6ThQSv0nCRD8NuI Qlvh/DWvp4Ov0P4IEq707AVYtWlzUPEYzJSYLzM0EAC4lREC5BcgRVDaYp0eqTAj1l6r DufN5Lb7g26e3lYgCIZHaFcwcBqSG0+jBZUOZPYe8j00kK1Ww7/eyRMjv31bIxK93+k/ I8oTQALLaz/nIlnBg4EBQZclcx4E1/X8M6WI5r9yw4OZD9V+u/BusRu13MpEYwZl4YtS OKpnhnb0PF+U699yHRTmu3OIeWDeYQDPI/dfH0GB2IHpfV260fBaxO+iTS5wIMYT/4Tc bPjA== X-Gm-Message-State: ALoCoQkHunaFgNz1avi51o67J7yMNVR5p31amiksBPZyuMpaW2XGHixWirlnC6qfVJTIxbogFIYE X-Received: by 10.112.151.210 with SMTP id us18mr17540970lbb.17.1413670495578; Sat, 18 Oct 2014 15:14:55 -0700 (PDT) Received: from localhost.localdomain (h-245-62.a218.priv.bahnhof.se. [85.24.245.62]) by mx.google.com with ESMTPSA id ku5sm1665259lac.35.2014.10.18.15.14.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Oct 2014 15:14:55 -0700 (PDT) From: Rickard Strandqvist To: Sebastian Reichel , Dmitry Eremin-Solenikov Cc: Rickard Strandqvist , Andi Kleen , Andrew Morton , Dan Carpenter , David Woodhouse , Grant Likely , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 4/5] power: charger-manager.c: Cleaning up missing null-terminate by switching from strncpy to strzcpy Date: Sun, 19 Oct 2014 00:17:08 +0200 Message-Id: <1413670628-6531-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.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 Ensures that the string is null-terminate in connection with the use of strncpy, by switching from strncpy to strzcpy. Signed-off-by: Rickard Strandqvist --- drivers/power/charger-manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/power/charger-manager.c b/drivers/power/charger-manager.c index 9e4dab4..18dad9e 100644 --- a/drivers/power/charger-manager.c +++ b/drivers/power/charger-manager.c @@ -1764,9 +1764,9 @@ static int charger_manager_probe(struct platform_device *pdev) memcpy(&cm->charger_psy, &psy_default, sizeof(psy_default)); if (!desc->psy_name) - strncpy(cm->psy_name_buf, psy_default.name, PSY_NAME_MAX); + strzcpy(cm->psy_name_buf, psy_default.name, PSY_NAME_MAX); else - strncpy(cm->psy_name_buf, desc->psy_name, PSY_NAME_MAX); + strzcpy(cm->psy_name_buf, desc->psy_name, PSY_NAME_MAX); cm->charger_psy.name = cm->psy_name_buf; /* Allocate for psy properties because they may vary */