Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1355202pxb; Fri, 21 Jan 2022 16:20:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJworQ+GXlh9nlmi+OdGCeteQYJSs4qul2nrAEt4Xz0TVmX6XSzE8l+zJxfX5hHyFT/0M53E X-Received: by 2002:a17:902:8d91:b0:14a:e2d7:d95c with SMTP id v17-20020a1709028d9100b0014ae2d7d95cmr5798765plo.154.1642810831329; Fri, 21 Jan 2022 16:20:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642810831; cv=none; d=google.com; s=arc-20160816; b=ozOj0V8SmALShGmeWlBeNzrR8vG8xDce1AOeHgb7thzcBszNMmlMZOR7f4tbp0iZEX Fm8xydMoObaddMAy8x72jEfMRHG3oJYIBtVdkc0bbyhXe1ILZRLgPv0FT4752ZjgOYOn uXsF3XC/2jICAt9+LjUwf4P71q8krIAVu5/SZZjnOH0oNHcPf+7XhoJl6VQS4gKlcRgc kom0L+0Kv6p5Zx7AN4rH2fVKR0afFkOa/D5Ca9ZPIhuzZiduzL5molIcb3xIZEvIYjWa qbpYGXh+tYCF84PJKrc+eb1P6sPKhMcz4lQlMHSSqHZrrMCtJxFELbbjGa+u2KPN6j9f USCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cin+GlfdvRxk53J1FH02Ed+P01nt3EuMJqBgh1QlF80=; b=gCBiY1dTx8MgkO/sDGuw3lZ1dHZYUKA/YtDvYFicASM2N6wwOcJQlBUXyOl2Oew4U0 Fp5QP0RxgRhssgFilxngHhxK/IU0jYHZCgpuHzF7738ro0jhSm1x4nmT+DfmJwJCYzRQ 22FoCxG/H2M6o9lBDRxIR4l8EvtWJyBwH2YEY8v+QFM59rfZVVBB2l3DKP5bWKP+DfZ6 R7o+gZNlvAHHUpbFq0jPrWYDvp5axzp/kt8IsyaMf2bXzZLmCCvXNEiXpYhsuENLy7Nl jk1Z2Ghuz9zF4aPX8JleGcAq+VQvBSG9bj7qfgy4/aarCMcMf2RLvo2iDofup50iCnsW tKeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aRYNOeoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w7si7856153plg.323.2022.01.21.16.20.20; Fri, 21 Jan 2022 16:20:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aRYNOeoT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378130AbiATW6R (ORCPT + 99 others); Thu, 20 Jan 2022 17:58:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:55247 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233856AbiATW6Q (ORCPT ); Thu, 20 Jan 2022 17:58:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642719495; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cin+GlfdvRxk53J1FH02Ed+P01nt3EuMJqBgh1QlF80=; b=aRYNOeoTmveGYHBmLr3BwhkkddyWKuoIuyu9rK/LAid/E0IvPMeg9e2VOvzbTmxMb77/Un Enm1yuvX6o501TJOevjQs0c36xBzT9NYq4v6d5nUkZZjWO8rZGvjsOjvBROAL3nd0dsnOF tNJFRBAxhQ6aiii0Kq1bwegwXYJqEBY= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-423-xVOmxtb0PD2xhD06p3wyBg-1; Thu, 20 Jan 2022 17:58:14 -0500 X-MC-Unique: xVOmxtb0PD2xhD06p3wyBg-1 Received: by mail-qv1-f71.google.com with SMTP id ib7-20020a0562141c8700b0040812bc4425so7750353qvb.16 for ; Thu, 20 Jan 2022 14:58:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=cin+GlfdvRxk53J1FH02Ed+P01nt3EuMJqBgh1QlF80=; b=N/p7lhhRSw7pp3DneKJ/ZSSqlseI6U9jMEU98T77VKCvnCYeA3kj8bHBrnjjuyH8NZ AHmpTJn8aGiaWYj0W/HaYC3XW0/ImryOvcxtgAIAVzlkUhB+TJp+R2RfZoiTn3kaq1Br WK5jl0mkeQVPDJDXwtTbf5Qg9vAKdRCwIyoUXETeovFgv8s4gYHoMYQ5fm7YVG1WJS7O udxwT/GR2OZk+BiGabz6kvdkRE32Rx1dumtsqqR/pJGLhkvT5bYA/e8uwPiorwsBILzO +UNo19setA/ZKUqR5MStq803gMNCL+6Ag4YrzSHlJKWi0fqRevV17dHGBzAbA8uAY43E 9tmw== X-Gm-Message-State: AOAM532a27V8o08Y/PkMabv30p4N4tym/6eZRhcNawnqAAOTAb/txLPG v1xEkdf6taLWsWFxYou6URXo3wPlt2XW+VI4Wa8w61T908Lf5ZaZeYo9/+5glodjQYBrOd0IIiR e8zHpUq81ECfDdH3y6nP5hS0/ X-Received: by 2002:a37:be05:: with SMTP id o5mr844132qkf.783.1642719493963; Thu, 20 Jan 2022 14:58:13 -0800 (PST) X-Received: by 2002:a37:be05:: with SMTP id o5mr844122qkf.783.1642719493766; Thu, 20 Jan 2022 14:58:13 -0800 (PST) Received: from treble ([2600:1700:6e32:6c00::c]) by smtp.gmail.com with ESMTPSA id x12sm2229325qta.79.2022.01.20.14.58.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jan 2022 14:58:13 -0800 (PST) Date: Thu, 20 Jan 2022 14:58:10 -0800 From: Josh Poimboeuf To: Peter Zijlstra Cc: Sergei Trofimovich , linux-kernel@vger.kernel.org Subject: Re: [PATCH] objtool: check: give big enough buffer for pv_ops Message-ID: <20220120225810.zqpbug6oj52c34cg@treble> References: <20220114075756.838243-1-slyich@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 14, 2022 at 09:53:07AM +0100, Peter Zijlstra wrote: > On Fri, Jan 14, 2022 at 07:57:56AM +0000, Sergei Trofimovich wrote: > > On gcc-12 build fails flagging possible buffer overflow: > > > > check.c: In function 'validate_call': > > check.c:2865:58: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=] > > 2865 | snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx); > > | ^~ > > > > I think it's a valid warning: > > > > static char pvname[16]; > > int idx; > > ... > > idx = (rel->addend / sizeof(void *)); > > snprintf(pvname, sizeof(pvname), "pv_ops[%d]", idx); > > > > we have only 7 chars for %d while it could take up to 9. > > Right, very unlikely to have that many pv_ops, but it doesn't hurt to > fix this. > > Thanks! Alternatively, 'idx' could just be unsigned char, since pv_ops only has about ~80 entries max, but either way works for me. I'll queue it up. -- Josh