Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3506413imu; Fri, 18 Jan 2019 11:35:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN43BGXnv+PtW6ZR6jb3VFk1s9EFBC339Sm+PFm8WtBGyGF8FeZSCvtRiON7G/Je97OAIQi+ X-Received: by 2002:a17:902:aa4c:: with SMTP id c12mr20420754plr.48.1547840139523; Fri, 18 Jan 2019 11:35:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547840139; cv=none; d=google.com; s=arc-20160816; b=rIkTaMgct41TERCqfpIabAMXPnrbkusaNbZtZtZ60f0/mgDDaonr5TRbtYLt1KEgVH 2oR+HA94xvhV4xSIe3w/XVhOEp8k2dBhf11q20NBc0reT1PW7E/+Z/4aP47d8AMxndmE l7pbX84BK8AE2yGs2oBbM9NwWCbpCllwXRc4MvedMXesLF49STVmiWWGm0th7TwpDtBk ooOd+tD6CmSKH5ch9q5gyOBoH0CW5yeuMGIGaQHEVnzRLWlaCbgo7sneHE9eXVjLLtLn sbs3XWXEVLXUBcn0Iu1kIT4/B0fR08FFuBuOO1n+5rDLyYiGPICp0hgnP0mWV8H04IcJ +s+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=TRCpHPmcL3Q/FzBd+YxD26DaTN93F71uPKvFToy/fks=; b=SQx6nvYFEHzJL7CAgyDv8OMV4sMjYykxhcmsO3Uqf3vhAbcI7yOiVfiM4zW0/PhdDM ussxI3uMWAoG90/KcjJkdFgC2uZRJKzAU/jiCyLZ22x53V5QX+Q9X65rQ+ybB1ko7XWn rDeQCXwSJcZAQbZXkJaxOBvVwjk7rSCLJEb17HQc8zEqvCefyxw2eMvZE2tEHwnoGB0b r1fpu3O+ESnnhXPAMv9ayZsw3HUwpGL5bSj+7bmLWm6W/QuL+qKKr1KSk7+D068i8pTX nD31OsnBFHst2ql3Q1HGk/rZDyd3XiM97w+l7RiNoQ5H+NSFnWyuooopovzzK7SxNvT9 yGrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jROV8S3o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e25si4579297pgv.486.2019.01.18.11.35.23; Fri, 18 Jan 2019 11:35:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jROV8S3o; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729313AbfARTc7 (ORCPT + 99 others); Fri, 18 Jan 2019 14:32:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33232 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729250AbfARTc7 (ORCPT ); Fri, 18 Jan 2019 14:32:59 -0500 Received: by mail-wr1-f65.google.com with SMTP id c14so16495955wrr.0; Fri, 18 Jan 2019 11:32:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TRCpHPmcL3Q/FzBd+YxD26DaTN93F71uPKvFToy/fks=; b=jROV8S3opgJsKR63YBxopDwZNZ3fgWttzQ6VXqkozRy3aEGlZkYWJifT79J3FTj676 nJoh0sGh6KpKDjgGlXVe50zXCaX0QU2bLkkyT8CVB4Cq380dAFamvqPisllfhA07sgu1 ZlOTo+aub4oGhz8hB0gYUgulFdGTs+7RNw7Xxqsdpu22iYwRMB5xNJLJX7qrkl5LXfSF b1Q/kwchf61WfWGgYKGJ/w9MZCanpsVWg1hBzxvD67NTOw0I6T5p3HHUm37nABEjOICS KbVsAML4ydfd1AZYMA2YkV7qOTxD2nmQFcOTXQH/KRwhYMdpPpb30iickRXGqxmIgF3A PJKA== 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=MZezzf7MVyPfGzGMMSr1+jg5E+YcjayhhQuRP1JPOZ9ZETzZiKYeNMjsSFOxBc+oH5 o6P4gT4M7j38+jQlVkVku2Lo6eK+UYo3a+PqzcZF8jXTOTIstpMh49ZFrnTAOmPMomC5 UVu9W+IPMsta3FjxXLWIYIfo49QjSZDs+pnKUDNIIsiP2ouYSammv3IzS2/wK8BhrMZO Ki5ZzZA9Q/Oa3/9bKpwv39J/9PxELywMDy5CWrVlX1Xx/DojJjaZTURWndYkBYPStsR9 wWTQgCof9GJBcmpyJvxRd9qt058tNoq6bo+1NZrnmjIzIvok6HzyOwUa+Bmx+Zs6CkRn IaHA== X-Gm-Message-State: AJcUukdJBGgCMK1OR8iGZkLF06TvjRVVofr/a+z9ErTct/pa0O+7/Jmq kQprsaJP8NGx0xx6UWEKBc5LCV++ 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 Cc: Mathieu Malaterre , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; } -- 2.19.2