Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3990033imm; Tue, 29 May 2018 19:00:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIQLwXNotYaAtJ+Ar0NyDcqCBPi6wRXsMVtxFNPDyyhSawnw6YktbPM1TL+PevjuCakns0d X-Received: by 2002:a17:902:5991:: with SMTP id p17-v6mr847606pli.191.1527645629717; Tue, 29 May 2018 19:00:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527645629; cv=none; d=google.com; s=arc-20160816; b=NLLgooFX7t+TDnlzNokk3/K0Md+stsDqp0mTTwFi0SwUj0Ip1IcJ6V+UFzAHJOmbQa 5g/uYKlCu9Wqvq7dsFY74g5QchYzKUvsrRb1yVtDBBBKPjxcQn9LH7A95pAcsYB3eT2Q mH9prT8QHYUcXq2KYOXwVRJGH8Qn6HeMZdljR7kO66gNV//fps3cFKvyqnNufO27AFwO 4fH72ve5tpvxdmMts9d9tPQUfEWUl2i0hqJibGyiNu/O6JV6L0bninfxWoH2SmsNmjT5 q5h5TjlPK3LZuTu10h2lnnyRnm0o1rOskiQ3bWvWdtj1taOZIjGxRaiYNYUzawm3pxs0 0T2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=K5bRDaYUphGCRsHCPSYR/qPLd8ZybLzPNee+LlCAUvs=; b=ewEh9OB19xbAucDpbmwdckVqr9PwQYPmkosKlJcBwKrQPFS1SEHzaMlYbnjfxcM94y wFAjCpQ1Q9FV5Cs/Q5WdXL16MUqvaYwdKOuwr9EaZsWgPr8bPv+ptF2KbFmJxI0ju3+t cvVM6+BGlOjo9YSED/5CHnrHYxqVCYZj45v8aSOJkW7VGLAX8bkq4x/U5bAD1y/qs82i GKOXEHueRFl8un/jiTw3Lpvj7LbPuzOC96lZnIBSuniVqSHBUGgN30mLa2rDDtHuL803 ku5zY+MgTPv85V2IQyZoS1rmFGKksqvxZdxPDniHTRiod6mxNdgt+PJ3azwe9EfHKYKu ss5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=A4RYCvCF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 127-v6si33827450pfe.49.2018.05.29.19.00.15; Tue, 29 May 2018 19:00:29 -0700 (PDT) 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=pass header.i=@gmail.com header.s=20161025 header.b=A4RYCvCF; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968606AbeE3B6n (ORCPT + 99 others); Tue, 29 May 2018 21:58:43 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:41605 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965890AbeE3B6j (ORCPT ); Tue, 29 May 2018 21:58:39 -0400 Received: by mail-ot0-f195.google.com with SMTP id t1-v6so19328432oth.8; Tue, 29 May 2018 18:58:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=K5bRDaYUphGCRsHCPSYR/qPLd8ZybLzPNee+LlCAUvs=; b=A4RYCvCFAPFEDGXh00pGJHOnOSPH/OfSYwnuiIaVUsvf7rE1rXdymPUhLJ8CHqaqlD P34izOujx1wJCXG4B/SC42KHH+Jwuwys7Q3LRmvWqXlXvOjqwhTszPy0LOpWoyZYCJM1 BhoYxOCr+/3Za6FVVI+9g1SxySV68kTqn0SzFgTu2yDR43BKr6DnNNGKBPBfEjZnvr/F XoHC4mGFR6Wfmik4OmUtV4+p95sJOrLU4MmlLNL0Qr9PmjmAPU8qL1WlrgdgAhVFC+jH d9wq/EQKgvO1VBqaZ5fTnD6g0WLFaxqnCj2RW9QV+IIyGJyllSU1l9ULLkoMLPwuTXKb 0brg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=K5bRDaYUphGCRsHCPSYR/qPLd8ZybLzPNee+LlCAUvs=; b=ZSrkXf7PwMDX8YUgHbtBVN6VF9jU9z7GdPgGzGCsYJNiTlEwHYR1VhyLhSWV4W7CIa X5/aedCVcrDKGoH6SmxeziP3O0dJNQqHfmny7DkT79nJhd5HNE4LLbanqIC/Jm5FxbVp 1vjyzFqb4WgtZpxZg1N9JmWQMorTlz5p5v5bHUvG8xWqJ2qBIUWNt1f0kfzA8qH+UafW qWpVSvNZCfTnEW5HGN5WzKleIstdGUQnGNLJVsP0bphJ3C/ai/BOeDBhkGeAuiAzmVT2 AqODXAeGDNN7wH2HA2f9UO3eL9/85jBm3sY2PWI1lZpzJcaQ8Snqxkc2O4wU+B7szfa6 CbrQ== X-Gm-Message-State: ALKqPwcYdsvYAFrnyc2KsbFW/d8Tf66y2eXT5c6IXJBexm7rXRYrVrst UD6emakM1vFf7LfwYt7XgE4L48JH/v2MWfDyZig= X-Received: by 2002:a9d:2511:: with SMTP id k17-v6mr472773otb.129.1527645519118; Tue, 29 May 2018 18:58:39 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:2451:0:0:0:0:0 with HTTP; Tue, 29 May 2018 18:58:38 -0700 (PDT) In-Reply-To: <1527577145-7750-1-git-send-email-nick.desaulniers@gmail.com> References: <1527577145-7750-1-git-send-email-nick.desaulniers@gmail.com> From: Nick Desaulniers Date: Tue, 29 May 2018 18:58:38 -0700 Message-ID: Subject: Re: [PATCH] video/hdmi: prefer strlcpy to strncpy To: b.zolnierkie@samsung.com Cc: Nick Desaulniers , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Linux Kernel Mailing List , ebiggers@google.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 11:59 PM, Nick Desaulniers wrote: > Fixes a stringop-truncation warning from gcc-8. > > Signed-off-by: Nick Desaulniers > --- > 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 111a0ab..46c184c 100644 > --- a/drivers/video/hdmi.c > +++ b/drivers/video/hdmi.c > @@ -168,8 +168,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)); > + strlcpy(frame->vendor, vendor, sizeof(frame->vendor)); > + strlcpy(frame->product, product, sizeof(frame->product)); > > return 0; > } > -- > 2.7.4 > Eric points out this can leak kernel memory if size is less than length of src.