Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2330132pxb; Fri, 5 Feb 2021 15:20:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZS7osc/CenvnvoC7EU6IaQqqH9cbC5pMtmcTkNk8yMedbP3vKJf7Y1Zv8VSEJIJnPZwqq X-Received: by 2002:a05:6402:50ce:: with SMTP id h14mr5838124edb.283.1612567223909; Fri, 05 Feb 2021 15:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612567223; cv=none; d=google.com; s=arc-20160816; b=tf3G2f6af5wXfWXyRGFX9XB5ot12p2XnBkYW5kID9UkluvCrPpSuGIzTJIkid9AVwz i0EXgIC2YNJFFFRnJUneu8uuEYV0+64rfHUlHvdQ3Rnv1WxWVZhzUrQL8u3d9VTJqPQk FM/zbAqpnL6Ci0gz5GQqPQGQl1t3PxTbJplKCc5M8KLQ2dvRVC4mT3M6OWukjkiNlBRn 650FvcV30pL+tpUx/2E3IFjSHFQPifEXMZr2zbWW8SDghuXJdXNdyN5vH3yYdr3D3TAl jdMyOsGrmjZwC3tg8p72T7bA1H4zhXVqtyZBGNi09cAkQdHcTNYlNYsnzJ4ZwrImXWfQ AZ9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=eGOOutKLxLHuDWRvK+M8dRwnjyV72qCzemkFRaNjMd0=; b=NibTW+DKA5vP7By4fBTw/P5WocJyt3H7zxTbRdzWoOYiVUXpmqwAO7KgQP+y+K8Lfp 4BgvsQIgstSRSNP0LkZi024yraqaJf9HoBmo5B474x7MuDugoHc3s9w2R5F8E0ys3RVh PN3Bpr4OPPn2F1YeoFeS6k9WJgGPGYlwJwtnHnkJ+JIFAmTfNGy9k683TWTwFSaM/D/L vAMWy+zGnhEOqbn6wgRxGrDzlPSvz/OfvDvFvBeR7DGD25KSbJXwoSk81sAwBEb1t9LZ oQWFJ5xxtOSGFXF1pmB1i8tuaAFB+lTa1JL7MxYJ1IR3M6y8g0Mv1xhuooPVFa1OoL3q PLuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chrisdown.name header.s=google header.b=fajAIsUF; 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=chrisdown.name Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay17si6878957ejb.41.2021.02.05.15.19.59; Fri, 05 Feb 2021 15:20:23 -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=@chrisdown.name header.s=google header.b=fajAIsUF; 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=chrisdown.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231801AbhBEXTT (ORCPT + 99 others); Fri, 5 Feb 2021 18:19:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbhBEO1L (ORCPT ); Fri, 5 Feb 2021 09:27:11 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 031FCC06121D for ; Fri, 5 Feb 2021 08:05:17 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id j21so3600266wmj.0 for ; Fri, 05 Feb 2021 08:05:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisdown.name; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eGOOutKLxLHuDWRvK+M8dRwnjyV72qCzemkFRaNjMd0=; b=fajAIsUFsEn4Zox3hchXK3vs/wPdWRAysHjxWZzANo1O3gtJ32uY2DiCuvME2i4zDK O87Tjlsrl+61Q5a6eUigMA8GbqtSh8miE/QXb4VGXirIHPwtxgr6+x/5OuWKUUXXtL34 vyfUjYHxEyVKs5YH0gMptOf+LMq/AwJAfdvNE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eGOOutKLxLHuDWRvK+M8dRwnjyV72qCzemkFRaNjMd0=; b=jgWoNwHyNIhye34724+ESafrqakva9Uu5qi1qvs/mDdCIN1uDOeEITiyOgNQOqnrmr ahmPW6Jw5V078MbyQjjN7YF36MpI69QPOcnmlypYMQX4eEuwGO0v6eesbTdWxblUJTsD pWxQLofNOBcc+USmnoNFnOTQn4DDXXLrx0iziVMDrX8ea6dhoZjFJrBYy+/HL8mVNA8k IQ7UtdAE7tZxG09n10/kemLleKYcQSI8ukUgLrN4IS2s1//klRwRehVRLq8W16LdFp1P OdGtfySvpbO0KWwQeQXLYiRfchy7yECkZ8ICJSUBYkvep2iUU3yHHtKzwfNy95TUqOd/ 3Uvw== X-Gm-Message-State: AOAM530ckZ+jhXNN7OdLWpODxNlwsWFalTpS4Q8zzH6Lcrp7mkbzBuVY +yRNFqxXi2AnxytDlC6SZOdFkWNfmTlXZ/+x X-Received: by 2002:a1c:ba44:: with SMTP id k65mr3733927wmf.25.1612535172614; Fri, 05 Feb 2021 06:26:12 -0800 (PST) Received: from localhost ([2a01:4b00:8432:8a00:63de:dd93:20be:f460]) by smtp.gmail.com with ESMTPSA id 35sm13879101wrn.42.2021.02.05.06.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 06:26:12 -0800 (PST) Date: Fri, 5 Feb 2021 14:26:11 +0000 From: Chris Down To: linux-kernel@vger.kernel.org Cc: Petr Mladek , Sergey Senozhatsky , John Ogness , Johannes Weiner , Andrew Morton , kernel-team@fb.com Subject: Re: [PATCH] printk: Userspace format enumeration support Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (da5e3282) (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oh, and one more I just spotted and will fix in v2 after other feedback is in: Chris Down writes: >+static void store_printk_fmt_sec(const struct module *mod, const char **start, >+ const char **end) >+{ >+ struct printk_fmt_sec *ps = NULL; >+ const char **fptr = NULL; >+ size_t size = 0; >+ >+ ps = kmalloc(sizeof(struct printk_fmt_sec), GFP_KERNEL); >+ if (!ps) >+ return; >+ >+ ps->module = mod; >+ ps->start = start; >+ ps->end = end; >+ >+ for (fptr = ps->start; fptr < ps->end; fptr++) >+ size += strlen(*fptr) + 1; This still works, but is out of date and doesn't account for the module and comma, so results in one more unnecessary round trip doing seq_buf_alloc.