Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp986368pxk; Fri, 18 Sep 2020 00:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSYI+n2r/47ZUnhyIjsN4ehZwY6D6/KhqsiPMQ4OQjLjTfnZ5jwk8cFtZp3NwAtYm2VH64 X-Received: by 2002:a17:906:3791:: with SMTP id n17mr33909024ejc.216.1600413101236; Fri, 18 Sep 2020 00:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600413101; cv=none; d=google.com; s=arc-20160816; b=xL4DhosQ0dXsRrWm6a0WeQbOCau0q9NVF0Dyena61lCqpcKuMxUCFlL4Hckmkyg5B0 kdHBXpK6noozuMTIFO2D11LSJYuIOAYKl8ccFhDl1+dhLNwDUtEHlhPK8FyjwX+QGacA p9TmxfOJXRvrLhBfPPoW/Lr/8RcEe49VA5WqBf3e4zz8Rnz9KnX9eRc1UIncuxRi6biG aJZJ/Ec1q9eqjstbTE3kALJAFz0Ilkh7yY9T2XEE2dpKRkxcL4ZmEdzoDn5TYA4mOsI7 r0TC4FAiOUy+iKAqLmNJp9IG89eTmyoNKPW3SRXlQW+me8Ake+etDYlYSnFyKlgT7vkb 2eZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gHQx1wQutwZZW5bRfLDKRYtGAOo0t33qpYibPb8HS6w=; b=dzmoQtWeTFQ2hzk3e9OdJhsSJuAU6rys7DUNiQbGjCNfCoYylEBZXee5auhBLtqFmJ hguK4KUspUDJtp+myHgmlmStkUF7OY+06JOfkK9btNU8i8N3mgsL5IylhgrVNZTJWJOS TYn3DPmYF036Drws4ib8qLW3wrx1FwFor3dVE4WdLev8K+Fb5SCbh4KOzj0NqTVjO4UG OUReI7VY7bPUI7pvI+K87MdWi6qhptHnFae2VvMLK+hrXxzgXiyhztC48T7GtE4OBHWg GCXZ3i2VkrUUlX06VQUMkgzeaPX2IQH2scGr1ieN8GxYqlbKH/g2lYzN9VO23NPQ1F3y QeKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b="AqMgvz0/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa23si1541096ejb.125.2020.09.18.00.11.17; Fri, 18 Sep 2020 00:11:41 -0700 (PDT) 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=@rasmusvillemoes.dk header.s=google header.b="AqMgvz0/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726335AbgIRGQl (ORCPT + 99 others); Fri, 18 Sep 2020 02:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726022AbgIRGQk (ORCPT ); Fri, 18 Sep 2020 02:16:40 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF58C06174A for ; Thu, 17 Sep 2020 23:16:40 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id w1so4942675edr.3 for ; Thu, 17 Sep 2020 23:16:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gHQx1wQutwZZW5bRfLDKRYtGAOo0t33qpYibPb8HS6w=; b=AqMgvz0/lfT7OGWSexawLGbk4NpHUWhJratmRvo0/XGdcK4QMSrc1xW6mFxTA820ZC QegZrAlf09ZOuc6VlVNj6/ODciH+guMGwjGJx76l/Zgx65iaRRnkjd54UCMPPzHJUFjQ ZNmzJOq9WaRE/FjE7LXdJFVvQKPfY4oSFXmFc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gHQx1wQutwZZW5bRfLDKRYtGAOo0t33qpYibPb8HS6w=; b=MnVgC938HLaTkzfgpwYF4MoLLQgt55mQulsWcFOq4NUkszquHuiN1SLSVM6UdKmzKg aKZW/TqRNbMgXCE8Ip6Vy0uKlYeLNlKj9WYOm45V4xHzBJP+hv4NNSR3AnBSBIUd0QRO kXvKARQ+40UrZZY/lrZlcd2gYbxI2o1xeZn8avOkZ9QKatUM4APp/aJ+x4ZZbwPSk6Ob +1fdA4kPKA+eBA7M8a5zuXLlsoSh30KPPOOrXCtaISjSEPwCak5YM8C8xks5ihpb6cjY k9u1skszxrjcdKHhiS/6xb3DrNlABC8he2S2ioj5DVpXoQIGwRo2jEw07ZGs83kyQNDs yaXw== X-Gm-Message-State: AOAM5309bvkw33Ia/LTVt08r09gwWq6qEJAgSZJNNZl7jNQW2Q0fjNd0 rTPaysH5RvLUdnucWx+f8bo8hjf9Faa78M42f2M= X-Received: by 2002:aa7:cb0e:: with SMTP id s14mr36133966edt.225.1600409798710; Thu, 17 Sep 2020 23:16:38 -0700 (PDT) Received: from [172.16.11.132] ([81.216.59.226]) by smtp.gmail.com with ESMTPSA id ef3sm1482056ejb.114.2020.09.17.23.16.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 17 Sep 2020 23:16:38 -0700 (PDT) Subject: Re: [PATCH printk 2/3] printk: move dictionary keys to dev_printk_info To: John Ogness , Petr Mladek Cc: Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Thomas Gleixner , kexec@lists.infradead.org, linux-kernel@vger.kernel.org References: <20200917131644.25838-1-john.ogness@linutronix.de> <20200917131644.25838-3-john.ogness@linutronix.de> From: Rasmus Villemoes Message-ID: <316cf147-0ae2-1c88-7375-07aedc58bd15@rasmusvillemoes.dk> Date: Fri, 18 Sep 2020 08:16:37 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200917131644.25838-3-john.ogness@linutronix.de> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17/09/2020 15.16, John Ogness wrote: > if (dev->class) > subsys = dev->class->name; > else if (dev->bus) > subsys = dev->bus->name; > else > - return 0; > + return; > > - pos += snprintf(hdr + pos, hdrlen - pos, "SUBSYSTEM=%s", subsys); > - if (pos >= hdrlen) > - goto overflow; > + snprintf(dev_info->subsystem, sizeof(dev_info->subsystem), subsys); It's unlikely that subsys would contain a %, but this will be yet another place to spend brain cycles ignoring if doing static analysis. So can we not do this. Either of strXcpy() for X=s,l will do the same thing, and likely faster. Rasmus