Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1726906imm; Thu, 12 Jul 2018 06:56:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc40lfLfdrza8lXTcvaGzjcyRMWI+CuevIUkpZqs/HoiQ2mMgPICEffR6dokSlI4BWcr963 X-Received: by 2002:a65:420d:: with SMTP id c13-v6mr2220161pgq.265.1531403799527; Thu, 12 Jul 2018 06:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531403799; cv=none; d=google.com; s=arc-20160816; b=JONLZlAFYn6EnDf5pseymKRgqorqj2adrNaLD8BpdksrzGRKZf9B73NvgQF6uZ9kZL k5xB5lj2UQZxDZ7zMRnAGKO4fXL0XTWFg2wskTwFhvt6tmrw4qzmkKGd/k/6RQSJlmJW sBxhJFhGeN0ngw8QcBzYpiokLKfeaBaYN2zqoA/M67gFxnSCSfC/0y4lAHAHJc18Dko4 jh8Q3Qt1lHifUXOjI5mzTfyGD2G9cZVFyyVxcWdRROUShLrik2SZyfsCPvTMLfe9LMZ7 DcNXjMLoSdOtQlR96W3EDk5wIcdE3hZAyscBH7xN2TY4UHXIy7aJqPS0AqjkVYX11SUc xqdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=o2v6b258rVkDyKcBamCIsppAy9856k6dljlKnrJyLYY=; b=XXtIhaNbIg7tXYaBPCrHDUPnZc9+DnOu8HW4SVUfYflmCEmnaoav6BjcIlzbH3FMok YvvU3G78uQNZpTwgTEYOrzEny/4lmIGCCcKSRMZhGtKIBBo9X161KY4PNRJ4kCOzEors dWqL3WR4xXTQIiaU3LGVaoE8b3GBLIsYvEznGhb3b/eDbN9C5UxuqYbNeZiY7ZjqEZqq wHijJufcLWSlq3nbzSTLP0MpgZ0oidpYyQk9iniXQe6SLLF4FetyAH9kSenlHgxEsHIZ 6twsBrxnvQdK7Wxciu/SzRXnKXzFPb100mT00+KWz2lwfzlieqtXP0j7qhioHI8H08Uy MMwA== ARC-Authentication-Results: i=1; mx.google.com; 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 k33-v6si21360767pld.269.2018.07.12.06.56.24; Thu, 12 Jul 2018 06:56:39 -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; 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 S1732522AbeGLOFY (ORCPT + 99 others); Thu, 12 Jul 2018 10:05:24 -0400 Received: from nautica.notk.org ([91.121.71.147]:47522 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732281AbeGLOFY (ORCPT ); Thu, 12 Jul 2018 10:05:24 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id D1298C009; Thu, 12 Jul 2018 15:55:41 +0200 (CEST) Date: Thu, 12 Jul 2018 15:55:26 +0200 From: Dominique Martinet To: Ville =?utf-8?B?U3lyasOkbMOk?= Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [Intel-gfx] [PATCH] i915/intel_tv_get_modes: fix strncpy truncation warning Message-ID: <20180712135526.GA5463@nautica> References: <1531295175-24052-1-git-send-email-asmadeus@codewreck.org> <20180712124401.GZ5565@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180712124401.GZ5565@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ville Syrjälä wrote on Thu, Jul 12, 2018: > On Wed, Jul 11, 2018 at 09:46:15AM +0200, Dominique Martinet wrote: > > This is effectively no-op as the next line writes a nul at the final > > What is "This". Please write self contained commit messages. This could either be 'this commit' as a whole or if you look only at the commit message 'this strncpy fix' from the title (which is arguably the same), and both interpretations sound fairly understandable in the context of the title line without seeing the patch to me... Although I'll admit this is difficult to judge of that as the author. Thanksfully, the v2 of the patch didn't use this wording but while I agree the message could be better I do not think it was horrible. > > drivers/gpu/drm/i915/intel_tv.c: In function ‘intel_tv_get_modes’: > > drivers/gpu/drm/i915/intel_tv.c:1358:3: error: ‘strncpy’ specified bound 32 equals destination size [-Werror=stringop-truncation] > > strncpy(mode_ptr->name, input->name, DRM_DISPLAY_MODE_LEN); > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > That warning should be in the actual commit message. Yes and no, I gave it for referrence but when you update to gcc 8 you will literally see it all over the place. The words "strncpy truncation warning" is really precise once you've seen them a few times and there are litteraly hundred of these warnings in the kernel, some have already been fixed taking a glance at the git log, some with and without the warning message. I don't think it's worth polluting the git log with this many warnings... Which leads to... > This same pattern is used all over drm. Can you go and fix them all up? > One might even consider writing a cocci patch for it ;) Now this is something I can agree with. This patch really was just a stop-gap measure because I could not build the kernel at all without it, but yes I did consider having a look at others. Unfortunately coccinelle does not run on fedora 28 (and doesn't look like it will fix itself any time soon, there is a bug report[1] open since February that didn't get much love lately - I was just looking at it a few days ago) I think in this case it might actually be faster to look at gcc warnings and s/strncpy/strlcpy/, but I am curious about Coccinelle so this is a good excuse to look at it, I'll report back in a bit after poking at that bug report and figuring out how coccinelle works. I do not guarantee speed however, if anyone sees this and feels put off from donig it themselves, please go ahead and just drop me a word. [1] https://bugzilla.redhat.com/show_bug.cgi?id=1544204 Thanks, and sorry for the mail longer than I originally intended, -- Dominique Martinet