From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC56CC433E1 for ; Wed, 20 May 2020 03:57:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 654332075F for ; Wed, 20 May 2020 03:57:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=axtens.net header.i=@axtens.net header.b="RupVthUQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 654332075F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C477E80049; Tue, 19 May 2020 23:57:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF80F8002C; Tue, 19 May 2020 23:57:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0D9580049; Tue, 19 May 2020 23:57:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0004.hostedemail.com [216.40.44.4]) by kanga.kvack.org (Postfix) with ESMTP id 979468002C for ; Tue, 19 May 2020 23:57:22 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 590E4180AD801 for ; Wed, 20 May 2020 03:57:22 +0000 (UTC) X-FDA: 76835737524.14.book05_6215a948b623 X-HE-Tag: book05_6215a948b623 X-Filterd-Recvd-Size: 4184 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 May 2020 03:57:21 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id w19so772885ply.11 for ; Tue, 19 May 2020 20:57:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=ytftJq4j1YH1FQpWCDVw46oQxuuWfHqAZeu5PQu5Tzk=; b=RupVthUQ83sxRLyitsvIhcmiGPK2Po7I/z826AfimUwFJzwEOKjyztPG3PJz/M/ceh 7Mau9QrlcCKdhTw4WNt5c9my04TbiPVVxalOvtvtcD9yDptMKNnb3R72QvV4V4CF/6RX 2jIZBke2vl3W9pAN1flGjYLGM3jp5/Dante/I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=ytftJq4j1YH1FQpWCDVw46oQxuuWfHqAZeu5PQu5Tzk=; b=HTIsCQ3in8GgJ3d/OXzMfdQD2V1evFK5We/9L3ZJqvIcn0rM7vaCySx/13YmDLn5rY AOWeYkUA/VQA3QfG2MZ6LX9bRkS0zufof4sLb2UvbVyeOjqWhwmQbM/lQggz9hoQr5eC 0haSl1+ugy7lM4ouoG+7RrDyD/wOUrGtPXD1rY3NTnmbNIeZYn2Vc5KsNTMTjKexvVsX FEFQkgITsasPaX8nuWa9Yeu2/qdPEbbqKtC+RAYKTZ61Alf2AgeAtpR3XD6bLERUbRox IW0QkL4apeZPQFM7kynYJhxtGwmzYNe9tyoBLTDYC2m9bHoGcHpZDKI5ZYyQfPXFQApd 7QYw== X-Gm-Message-State: AOAM533i9LSoHlhskt6rP8nCyDW8g4VkLQyZa9PCetAFEgV26jJw8zf3 /jbwUP7S7lND01Y+NTnCSdjEHQ== X-Google-Smtp-Source: ABdhPJyVuLf9DuTf0O3M8vk5AY3/sZqJfDELQ7nOpLn+HThDx00allfpx82tsOz+YkQ6sH4/KZp65A== X-Received: by 2002:a17:902:9888:: with SMTP id s8mr2783660plp.168.1589947040946; Tue, 19 May 2020 20:57:20 -0700 (PDT) Received: from localhost (2001-44b8-111e-5c00-b5ed-d3ff-25d3-7e68.static.ipv6.internode.on.net. [2001:44b8:111e:5c00:b5ed:d3ff:25d3:7e68]) by smtp.gmail.com with ESMTPSA id 65sm776761pfy.219.2020.05.19.20.57.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2020 20:57:20 -0700 (PDT) From: Daniel Axtens To: Andrew Morton Cc: kbuild test robot , kbuild-all@lists.01.org, Johannes Weiner , Dmitry Vyukov , Linux Memory Management List , linux-scsi@vger.kernel.org Subject: Re: [hnaz-linux-mm:master 156/523] include/linux/string.h:307:9: note: in expansion of macro '__underlying_strncpy' In-Reply-To: <20200519184847.5affb9238b7358ac0d18c98e@linux-foundation.org> References: <202005191736.t1JQZSrV%lkp@intel.com> <87blmkhtpy.fsf@dja-thinkpad.axtens.net> <20200519184847.5affb9238b7358ac0d18c98e@linux-foundation.org> Date: Wed, 20 May 2020 13:57:16 +1000 Message-ID: <875zcri7hf.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > inqdata[0] = TYPE_PROCESSOR; > /* Periph Qualifier & Periph Dev Type */ > inqdata[1] = 0; > /* rem media bit & Dev Type Modifier */ > inqdata[2] = 0; > /* ISO, ECMA, & ANSI versions */ > inqdata[4] = 31; > /* length of additional data */ > strncpy(&inqdata[8], "Areca ", 8); > /* Vendor Identification */ >>>> strncpy(&inqdata[16], "RAID controller ", 16); > /* Product Identification */ > strncpy(&inqdata[32], "R001", 4); /* Product Revision */ > That strncpy() will indeed fail to copy the trailing null, but it looks > like that null isn't appropriate in the inquiry data. > > So I suspect this is a valid usage of strncpy() and the checking is > just too strict. > > otoh if this is the only place where we hit this issue then perhaps we > can switch to memcpy() and get on with life ;) Hmm, yes, I think you're right and gcc is being a bit ambitious here - although I can understand the warning given that the behaviour relied upon here is rarely going to be what the developer intendend! We could build the file with -Wno-stringop-truncation, but I do wonder if memcpy might make the semantics more obvious... Regards, Daniel