Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1515422imm; Fri, 22 Jun 2018 19:23:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKmus+t+iadeAwE/DbbM6RihgJWEztozPYKaxk3ass7ts3FflKy9FnuWsV2UfzJK99MnrIi X-Received: by 2002:a17:902:6e01:: with SMTP id u1-v6mr3883451plk.96.1529720626823; Fri, 22 Jun 2018 19:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529720626; cv=none; d=google.com; s=arc-20160816; b=al2D6J+BcLy+PNfkF+kAPXglxyzGcTp8rE5fhA5xkOOdvNaqgluZBEJkqF8biRPTR/ nr+XpflnujyVTLxycJFtngWZ3FiagFfTdOJ/wigCLOxz74Fx4jRTq9HmyW8UlYegNQsJ 8IwBqIJ++A6VEbrRnhRjVfly1i+QUTrV28Y6mTW4cP0lYdbISGfumG3JTcJc2ppoEyq+ wFzFYf4ga6oA+iOOHSkTl+nI5R7qHSkde8Pf89ghfD6QYwccVzwhFZFHduHzEEmtS63b HnOw3hKkOrWlS8xDum6IgQ2IThya7WbNlWwpZSO2jY9aoPHnDEjbdCETkmbViSEF2kCP REIQ== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=m6tqfOlJVWDA4H2/n763TYEcyCQKcv6oGMLWRzkv7v0=; b=e4WNEwebBxaBbGfqizAsNlkvk2wUMLxbU1qgGbgmSy/NAzXWGrdYrTiCjdY6eADxBf QGuWPXc+fVw8vhPzVzOD0DqyshGGxNpP5hhywhykSv4ifGiClwXWzR7FbzQUqj/cbZJC oODY7YiSElNFbFKnoU7W3dgQBI642bcH2+/TvvpI+yH92epfbYMdhyJ1dKkpz8v95wF0 7tng0MsIZt7AX7QPP6eEXif8ZwlurSApkI2xQJxBJuVLm0dKpOxbjr1j1cDx3C/jKyEh aWrp/9vv27DLixHqNRffe4+XL2SfNU84EWRrEZDxwvjlqGiV1CZwlOZ/cnGHYnH8F+pT Y+Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tYip9nvI; 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 t76-v6si7339761pgc.393.2018.06.22.19.23.32; Fri, 22 Jun 2018 19:23:46 -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=tYip9nvI; 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 S934948AbeFWCWY (ORCPT + 99 others); Fri, 22 Jun 2018 22:22:24 -0400 Received: from mail-yw0-f195.google.com ([209.85.161.195]:43455 "EHLO mail-yw0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934626AbeFWCWV (ORCPT ); Fri, 22 Jun 2018 22:22:21 -0400 Received: by mail-yw0-f195.google.com with SMTP id r19-v6so3027849ywc.10; Fri, 22 Jun 2018 19:22:21 -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:content-transfer-encoding; bh=m6tqfOlJVWDA4H2/n763TYEcyCQKcv6oGMLWRzkv7v0=; b=tYip9nvICtvdMmPxngeeevAI2c4dwxcX3xMXMXmzq62K8MfsmOahvG3SLhlhPtzSVO o03WBJB85a9flf1gGwicbdsn0QPWCV50KrB7jmGexOLgVDwsOD8H400uiMhHvMe+g4Di rYXUre4LEo0iLlxCQTdANkP8/t70mfucS24pSilYtIMXRsAFU9K1i/GRzzb0S2mHHY7+ jzEEIYLamAwpB4m6dPzMFXy4yphqrhjcE6spQHWIhdp4U/XafFSiyaFJBhQXcXDtuvQ6 329uB/RCQmQBxypUXgOAMkBewjI5ek3AnKuReJ/F+Z1BwZ1bkM14R0WLMEGwx/poFOnT weUw== 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:content-transfer-encoding; bh=m6tqfOlJVWDA4H2/n763TYEcyCQKcv6oGMLWRzkv7v0=; b=hlIwTw61hwQyVOGOAm2gfMJW7B3L+a6GxC1yprsLbAvE2glVE8nPoYC3l6+rzxH/JC YrA1nqoApW7ffwXp1J3+uDtFEqM0G6CUowKc4epV6PMKmiPsHbaTx0IgoJeCgRYBZ/uQ Ge3iumAcQfdn9Pvo9NMfuz1CbVwH6I3nEksH+ozEJVxlMAO4+BioSz6yI/QCtGLWtTll /f6EAteDxAuxFLgdIwxcb0MK9DI6DAJlqvY3iXYMAVyIaq0LKigVOsePf+5MJaULANeQ yRFP3agzvjZu3G7i8+X0G/MfyLB60r3tstwFOKWOzipo3TE4kNW8hRw4nAVjmmrRsEI8 jEGQ== X-Gm-Message-State: APt69E3TG+kcbtnH91zwVpE3QZZMUqBU5JxD2ZlwJHHD2K6Vhyle9ks6 RZ67itBgs15gkedXmUETF5lKIqaQrH+VhaG5kVU= X-Received: by 2002:a0d:e446:: with SMTP id n67-v6mr2047337ywe.112.1529720541318; Fri, 22 Jun 2018 19:22:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:61d0:0:0:0:0:0 with HTTP; Fri, 22 Jun 2018 19:22:20 -0700 (PDT) In-Reply-To: <20180623020753.27266-2-shorne@gmail.com> References: <20180623020753.27266-1-shorne@gmail.com> <20180623020753.27266-2-shorne@gmail.com> From: Max Filippov Date: Fri, 22 Jun 2018 19:22:20 -0700 Message-ID: Subject: Re: [RFC PATCH 1/2] crypto: Fix -Wstringop-truncation warnings To: Stafford Horne Cc: LKML , Greg KH , Arnd Bergmann , linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 22, 2018 at 7:07 PM, Stafford Horne wrote: > As of GCC 9.0.0 the build is reporting warnings like: > > crypto/ablkcipher.c: In function =E2=80=98crypto_ablkcipher_report=E2= =80=99: > crypto/ablkcipher.c:374:2: warning: =E2=80=98strncpy=E2=80=99 specifi= ed bound 64 equals destination size [-Wstringop-truncation] > strncpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "", > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > sizeof(rblkcipher.geniv)); > ~~~~~~~~~~~~~~~~~~~~~~~~~ > > This means the strnycpy might create a non null terminated string. Fix t= his by > limiting the size of the string copy to include the null terminator. That could work if the destination buffer was zero-initialized, but it's allocated on stack and is not initialized. Replacing strncpy with strlcpy without changing its arguments should do the right thing. --=20 Thanks. -- Max