Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp4174468rwb; Mon, 16 Jan 2023 19:31:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXsiHoaavEjTpR4smP3iMfFwjPSafsYGE6S8Nzgb56abh29qQ0jXk4jEULnSRxmPsBeg6KYX X-Received: by 2002:a17:906:4f07:b0:864:223:40b with SMTP id t7-20020a1709064f0700b008640223040bmr1350140eju.33.1673926285183; Mon, 16 Jan 2023 19:31:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673926285; cv=none; d=google.com; s=arc-20160816; b=gxOAyto3VwWRjlJsGko6xbfid2cp7msNeXMEOz529/Ku2WU9nuzbh4kQ5VUN/KrI6N 6vHpsJh/Mbq3lTgaqcBWOlTjackSG02AaG0H3wjZ9jsc+ncjZhw/XQJWCr1VRg0yhMs3 H9Bao1XTwSbDHdlD65WPDykBqlQJYtgM7NAsWKDoRL2Ttg4D2RY7iuauSs6g4jCrhSGs 2r4otkhIkUKTrwgDNEDVARRqRv/bvV4WMNGRyl8RBg9IW68aKSsvHis2xbHp7ogWP3pu 9vfgZoYOQ5EkFDvLnc43rmhzszTuMeI4MhIpncnNUYn/yiXieNRZD8rJ8wO6VqSLxZIP 9oyA== 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=pnJ9Zmocxu4Xq5ufmgMvMkKxKjqhgHcC/CXVZl3M6Kg=; b=TMRK+H1QG12Uc0FUDcOVgzFLXXZrVnk2aKNVoDuiqXxMAUrsx0HKEecOhmK1IMylpS sG5mTH7Pm6ySCpnmMHtl/fldUvjwrKmS7QTBr367J/WMviXDfLzXgVlUGMRfdklKOnrj omfa1/zS8xsLwogzKJWY0sJ+/qTS/IWrWaP0LTlIIG6QlcJIsLmE8fFTGiBPDgf9Kw3O DnbSPNDm6h/aIcEdeL2h2Bd6Y5jM/dv2HEfcr5IeaiOvde1SouJ2vwakEAc41JuFqlYF suT4HDesVAXDxhjZJwdzVBHGpOa1hysqT1m3Qu3SoOBmqyy6vURjnIBciSYy7SRnERX2 BehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="VT/EEiv5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg12-20020a170907a40c00b008650ce2978csi14148050ejc.251.2023.01.16.19.31.13; Mon, 16 Jan 2023 19:31:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="VT/EEiv5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235637AbjAQDIE (ORCPT + 49 others); Mon, 16 Jan 2023 22:08:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235693AbjAQDH5 (ORCPT ); Mon, 16 Jan 2023 22:07:57 -0500 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6077233D6 for ; Mon, 16 Jan 2023 19:07:55 -0800 (PST) Received: by mail-pl1-x635.google.com with SMTP id d9so32146534pll.9 for ; Mon, 16 Jan 2023 19:07:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pnJ9Zmocxu4Xq5ufmgMvMkKxKjqhgHcC/CXVZl3M6Kg=; b=VT/EEiv5boIzMV75DdA9/aJwFxF8Is84Rhw3/LYBmRMMYQpCUAgfOvntIelHvMClTW yMMYT/gArron1p5NI3ZWwNx7VwexbGk5nFEciNhajeDchErJns5L+5ncMt8OcUPsVqtQ jQb27l54t7AeQHJvNQXLmE7rhaplUy52bbmBU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pnJ9Zmocxu4Xq5ufmgMvMkKxKjqhgHcC/CXVZl3M6Kg=; b=05R8d3jyPE0Jyqyh9lmeAzwp0JwJcTOAglwZEHrEECNsPao+PinCEa8MaYrtObxHiw AXkfM2Vx2kAYxFcFGKRmM8Q1eXYY+KRKhFedyJhXfrBiGq3WGhP3WkmqAMfFzaKYYCrU twQOY4BLqnZWI7KyzX+eX1K8Y6P6h2AyVOFLiKFoz5/scgzaqpCYOB7RRoQZ64109Y2P 1+Lu4Ivqf7IGTDp7ft9+redkxbrLI6LRqxE2lONZuRCKbIY+EcAIArPP/T5VovROkYN1 z/XwyP6HgFEJzMbl95ruHaLkFXYnookqCfL+Fpt/+03RvHEU+taXs1o2mtBuvJAjk4zr wQXw== X-Gm-Message-State: AFqh2kpt5OtEbYFD9u5H307x32ukl1CUsTu8O1aicAnQDpj83oINRZAo sn3rT+qooeWAXF8jxXv98qml/w== X-Received: by 2002:a17:903:54d:b0:193:a5b:ccf6 with SMTP id jo13-20020a170903054d00b001930a5bccf6mr808312plb.0.1673924875310; Mon, 16 Jan 2023 19:07:55 -0800 (PST) Received: from google.com (KD124209188001.ppp-bb.dion.ne.jp. [124.209.188.1]) by smtp.gmail.com with ESMTPSA id s21-20020a170902b19500b00189e1522982sm19987634plr.168.2023.01.16.19.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 19:07:54 -0800 (PST) Date: Tue, 17 Jan 2023 12:07:50 +0900 From: Sergey Senozhatsky To: Petr Mladek Cc: Sergey Senozhatsky , coverity-bot , John Ogness , Steven Rostedt , linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: Coverity: console_prepend_dropped(): Memory - corruptions Message-ID: References: <202301131544.D9E804CCD@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (23/01/16 17:35), Petr Mladek wrote: > > I am going to send a patch. Sure, sounds good. > The code might be safe with the current size of the buffer and > the string. But it is true that the following is wrong: > > len = snprintf(scratchbuf, scratchbuf_sz, > "** %lu printk messages dropped **\n", dropped); Wouldn't if (WARN_ON_ONCE(len + PRINTK_PREFIX_MAX >= outbuf_sz)) return; prevent us from doing something harmful?