From patchwork Fri Jan 18 19:32:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Malaterre X-Patchwork-Id: 10772465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96E2113B4 for ; Sun, 20 Jan 2019 17:04:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82DEC28B3E for ; Sun, 20 Jan 2019 17:04:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 776512A50F; Sun, 20 Jan 2019 17:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4EFFD28B3E for ; Sun, 20 Jan 2019 17:04:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1ECE46E61D; Sun, 20 Jan 2019 17:04:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9467F6E0E9 for ; Fri, 18 Jan 2019 19:32:58 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id u4so16456353wrp.3 for ; Fri, 18 Jan 2019 11:32:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=TRCpHPmcL3Q/FzBd+YxD26DaTN93F71uPKvFToy/fks=; b=YQQpGjWcTk0byIUdcP7FpTtnLNhK0dGd0/IChZRrCfomdDzLXynLSlAQ+/2ojSapGs X4UrjcjQfeNYg7wCkftGBnm9P9UnImQ4FmGEZYucC7c2AXvW+njTYE1c5YkZZc7GZ7mC kuc8HeTXRp7CfC0Ooch/6v+/1WIoF0PHNVm7LphGCNzpszhm15CrgSTBcQEJfKazyPzW 7EaMI5imo1pgW0MU2sCZDNTjZSYsAgzmdr+ADK6BuOeHydEg1xcTWSl5jvLFCjypBQXZ +g827akRBrMihihcbHfAPygdbj/oJOiXddm74BC76C2ZDpV8fWCbp2gVnWijws+dYD+p fM3A== X-Gm-Message-State: AJcUukeJ21WqUdiSKtNv7P6MRe9us12JqwIiNMYH/Q1CyL+/YvUUr3nZ R62NrLquyMSynGmLcjDfsrM= X-Google-Smtp-Source: ALg8bN6xmkbtSOiTgxh9IcXWhl2ic7vVCmcefobuYAAHnNI/alulfiLgB2n9GKnV4iUDBAXLxP0FHQ== X-Received: by 2002:adf:f308:: with SMTP id i8mr17181847wro.219.1547839977102; Fri, 18 Jan 2019 11:32:57 -0800 (PST) Received: from macbookpro.malat.net (bru31-1-78-225-224-134.fbx.proxad.net. [78.225.224.134]) by smtp.gmail.com with ESMTPSA id f15sm84035525wrt.10.2019.01.18.11.32.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 11:32:56 -0800 (PST) Received: by macbookpro.malat.net (Postfix, from userid 1000) id 658851142393; Fri, 18 Jan 2019 20:32:55 +0100 (CET) From: Mathieu Malaterre To: Bartlomiej Zolnierkiewicz Subject: [PATCH] video/hdmi: Change strncpy() into memcpy() in hdmi_spd_infoframe_init Date: Fri, 18 Jan 2019 20:32:48 +0100 Message-Id: <20190118193248.535-1-malat@debian.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 20 Jan 2019 17:03:52 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mathieu Malaterre , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Using strncpy() is less than perfect since the destination buffers do not need to be NUL terminated. Replace strncpy() with memcpy() to address a warning triggered by gcc using W=1 and optimize the code a bit. This commit removes the following warnings: drivers/video/hdmi.c:234:2: warning: 'strncpy' specified bound 8 equals destination size [-Wstringop-truncation] drivers/video/hdmi.c:235:2: warning: 'strncpy' specified bound 16 equals destination size [-Wstringop-truncation] Signed-off-by: Mathieu Malaterre --- drivers/video/hdmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c index 799ae49774f5..553c39ac8f9e 100644 --- a/drivers/video/hdmi.c +++ b/drivers/video/hdmi.c @@ -231,8 +231,8 @@ int hdmi_spd_infoframe_init(struct hdmi_spd_infoframe *frame, frame->version = 1; frame->length = HDMI_SPD_INFOFRAME_SIZE; - strncpy(frame->vendor, vendor, sizeof(frame->vendor)); - strncpy(frame->product, product, sizeof(frame->product)); + memcpy(frame->vendor, vendor, sizeof(frame->vendor)); + memcpy(frame->product, product, sizeof(frame->product)); return 0; }