Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1984640ybt; Mon, 15 Jun 2020 14:56:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaJdTszNmRziTy6bIWQ8ueWzDdaDwDLQEAqFMbD9IFTJlotbuibOf3m2FwfmNQZk5GVZNh X-Received: by 2002:a17:906:3154:: with SMTP id e20mr28428978eje.171.1592258185987; Mon, 15 Jun 2020 14:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592258185; cv=none; d=google.com; s=arc-20160816; b=Ku+j0NQ0O4B6RXKgoFYToD+d7UHXwf3NjP1E4jFeZ+9Vs3PW7kgYm2jimEQU90wRnb EIrkkCyuHanQGD9S+At44xnyfeP0WGBTKTaiTBd+NOn2yPEaTmDQ6sVndwuM+yLTQ5yK /Qyi5+Ke8cyBEwRm3pDnbtVnINorM02hPjnaV0Xxrx3dNdhciYRhy7jqspZof28jE8Aj EpltXWIAx8MXjtRRyiDfEw1xtg/r0uyZrJsiTElIHd09LpnTiS0L0V45zskKj+EuInE3 NJZG3p4v2BxPhHw2DAHR9EtxFx71dSG1QAzMFonjccNmT8wbvfhAao+aA1UXVdN4IHn7 17zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BrYyEhrRR6A5rIUcHiiWKnKi36VydppgntucqfFstLE=; b=aBsMncxv/vDh0F9Up6QQafIXGF/UCdgCxqBGDBcQrLuqI6XU2wi5P8tmJ6IE7VbRkW xlc+OAhPQfraK2NIrJ7Dx3yOL0tckFxWWe60xa2ldaZH9r0sxTVr78Op6lHdjVAQwHf5 T2emhvvXWCpid2geBiiOPyC+YXW1NhQiPKAo4nYXblSK4lkNZDCfIViiTLNuYasfmO0Q LPYy0P1RoWoXYZKRpBxf9iBHV0lRGnDGY1rN1Luo90skgbBpgVJ5laXB2mJwNQM2zvNC sDQrnASDGXC4xkm/lzB857xOdtVVOg7Gjn02jJvWkDDvqyY7x+7fOCkeAPLKN8UuYnB1 tEEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=bwm6eR+s; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bn18si10330980ejb.82.2020.06.15.14.56.02; Mon, 15 Jun 2020 14:56:25 -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=@gmail.com header.s=20161025 header.b=bwm6eR+s; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726344AbgFOVyN (ORCPT + 99 others); Mon, 15 Jun 2020 17:54:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbgFOVyM (ORCPT ); Mon, 15 Jun 2020 17:54:12 -0400 Received: from mail-vs1-xe43.google.com (mail-vs1-xe43.google.com [IPv6:2607:f8b0:4864:20::e43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73CD6C061A0E for ; Mon, 15 Jun 2020 14:54:12 -0700 (PDT) Received: by mail-vs1-xe43.google.com with SMTP id u17so10288672vsu.7 for ; Mon, 15 Jun 2020 14:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BrYyEhrRR6A5rIUcHiiWKnKi36VydppgntucqfFstLE=; b=bwm6eR+s1orKJ3oyZ9Evd8YxotI8L3vP/Xg/h+t06qh76qO5Lb51v1SB9upmRYjV2f cG2cX/p+DjUzsyOcbhFkET9YLFuu6WWZUAKAu+xZ5n/O8eWl48D258TMWnh/L1FDxiee Qjju8cTjw4FT0zGUpcc+hyctWFGLmL6TpQ5dnV79SQBAidhMFi9bb6B+L2yksoC0jFo/ Ot8lzg/2tgTyb8JZuPn5BYqIdpFxwxB2Mj4MNliPscaXm0T4nnncQ2i/0q0VJ7ZgWIBI mNpuNpDqdhsl3XVgzxSlWXAXUaEUui5mGUSwvHV7UuyK18mFMu0c2noUSGL5vvED4t3L UhSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BrYyEhrRR6A5rIUcHiiWKnKi36VydppgntucqfFstLE=; b=tFJ3SwMOyZ+JXLtBJurquz5+Lr2OlH+NflQRTgZKRYt/lCTIBQufVmQpm/gsDMJZBJ PU28FnaU48uC6kR5U80IxHlctQciyp5IXSn3YaGh88L1H4gAyqKM/V/9fyXuiG/Jn95j uIdN9TlT8NVvp0T+qzU5yfQAJBHXcosc1Fme8Omh5jzYRdPuniL1TYzuqVk8MOrJiMbD Pp88gqFWDMrE7VLFU9ZX+F4fwJZd2aOXvTeQOmejP5CL3I6KpahnHe805tpyXG+Uq9TS xkM0mALyuLMZIbO7wfTwn3S6QL1GEdSSQWZVUO4N9TwP/ViHOkxndDCsO2+V6F1HK+LI OQiA== X-Gm-Message-State: AOAM533B5NEps4xBp7NMRW2c8pWt5xMpywEMEAnmh/HE5zxCassOhlyG 2fXJrW4Ik5yLJJfCmNfmqNHFONDth8dmoufcUK8= X-Received: by 2002:a67:f918:: with SMTP id t24mr21149749vsq.18.1592258051538; Mon, 15 Jun 2020 14:54:11 -0700 (PDT) MIME-Version: 1.0 References: <20200613155738.2249399-1-jim.cromie@gmail.com> <20200613155738.2249399-8-jim.cromie@gmail.com> <20200615132028.GE31238@alley> In-Reply-To: <20200615132028.GE31238@alley> From: jim.cromie@gmail.com Date: Mon, 15 Jun 2020 15:53:45 -0600 Message-ID: Subject: Re: [PATCH v2 07/24] dyndbg: fix a BUG_ON in ddebug_describe_flags To: Petr Mladek Cc: Jason Baron , LKML , akpm@linuxfoundation.org, Greg KH , Rasmus Villemoes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 15, 2020 at 7:20 AM Petr Mladek wrote: > > On Sat 2020-06-13 09:57:21, Jim Cromie wrote: > In all patches is missing: > > Signed-off-by: Jim Cromie right, I missed the -s invoking format-patch, v3 will have them > > > --- > > lib/dynamic_debug.c | 31 +++++++++++++++---------------- > > 1 file changed, 15 insertions(+), 16 deletions(-) > > > > diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c > > index 9b2445507988..aaace13d7536 100644 > > --- a/lib/dynamic_debug.c > > +++ b/lib/dynamic_debug.c > > @@ -87,22 +87,22 @@ static struct { unsigned flag:8; char opt_char; } opt_array[] = { > > { _DPRINTK_FLAGS_NONE, '_' }, > > }; > > > > +struct flagsbuf { char buf[ARRAY_SIZE(opt_array)+1]; }; > > This looks too complicated. What about? > > typedef char flags_buf[ARRAY_SIZE(opt_array) + 1]; > used as > flags_buf fb; > I used the struct to give type safety. old code passed a pointer to a string, and hoped it was big enough. then used a BUG_ON to insist. passing (the address of the) struct means the contained string is known big enough. and the addy is also that of the string itself (member offset 0), no overhead. > > #define FLAGS_BUF_SIZE (ARRAY_SIZE(opt_array) + 1) > used as > char flags_buf[FLAGS_BUF_SIZE]; > I never needed that constant, cuz the string is filled once, in the function just below the struct def, using the same expression (sans +1) I would/will update the 1-line comment on ddebug_describe_flags and add another on the struct itself, once I figure out how to say all of this succinctly and clearly enough. Im open to suggestions. thanks jimc > > Best Regards, > Petr