Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1662149ybt; Mon, 15 Jun 2020 06:23:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGMsZib4TRPVZnwYHlCL2O8FYAite3FQSHjJsYodETYL9Kky1Pi0NeakuUuv8yewgWhtVl X-Received: by 2002:a17:906:6a4b:: with SMTP id n11mr24575614ejs.198.1592227404232; Mon, 15 Jun 2020 06:23:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592227404; cv=none; d=google.com; s=arc-20160816; b=VY+y3zgCMwRJgNyYt6oy6JjlSWKYru2WyWrApV6jNnotLHXHQ0Qg8t9xBJC7Jo6yFk svaxMg1c3JxwRW4VnEB67RG68mQHaEO5tpUl4JKeoQbCcxe45Kj0eR4H41ax+CCvk3gq 2U/wuTJpOOzvOLkfdWxzN6PHO1i6n0uRid1fZqmIrnJsKykPoqE3Sbtvh4Fp7N5oCSpA BN+KjpzQ1PRqo3h+Yd8b94p+/5ZxFlR1TSde0ktIL5JHDOOEeViQavZRhAEuTEzxUA0L s26w6fzJwCj7be3kDL6QhWyiNWBppAVy1Rjh1Qt2nicUEFaQeCzYNXFnGb3KcuwLT3i0 OGzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=XB3mxcVSKzKlNVPl92x6SyOTmscNypEj/SoapRX2aeA=; b=i/RfdTk7tH2wlXRkEBgSb1Ipb1YuRuU9Zu4/ft1a4MbrZhY06ZzorGux89o6/KKr88 lfg/h4Q+1V1mezBOyQW3qHxJyT55RSf/ZjGQfdIoNqTjP7m1IZG3arA/O2z3Izw1zmIU ylvSq3lbHh53osErUYUFEMan0RJX/8L0wX0mOWSWrvC/JQBmrEjBYuIb0oHuLRLX3lRE FkPTi7PSX908BMdf6E4VaUjCVeX3kbzkVX4fAxvhEv1QlIKLE51asoFAPaDt3Duf5+c0 oxjBjH7BVDn0ppxXYxMRHkjCs9KBULtymDVvTkw2SlbN9rZ2FYCdf4T+asGam/ZCQLVn 9kqA== ARC-Authentication-Results: i=1; mx.google.com; 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 ds2si10807086ejc.114.2020.06.15.06.23.01; Mon, 15 Jun 2020 06:23:24 -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; 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 S1730378AbgFONUb (ORCPT + 99 others); Mon, 15 Jun 2020 09:20:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:52140 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729916AbgFONUb (ORCPT ); Mon, 15 Jun 2020 09:20:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 8503BADE2; Mon, 15 Jun 2020 13:20:33 +0000 (UTC) Date: Mon, 15 Jun 2020 15:20:28 +0200 From: Petr Mladek To: Jim Cromie Cc: jbaron@akamai.com, linux-kernel@vger.kernel.org, akpm@linuxfoundation.org, gregkh@linuxfoundation.org, linux@rasmusvillemoes.dk Subject: Re: [PATCH v2 07/24] dyndbg: fix a BUG_ON in ddebug_describe_flags Message-ID: <20200615132028.GE31238@alley> References: <20200613155738.2249399-1-jim.cromie@gmail.com> <20200613155738.2249399-8-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200613155738.2249399-8-jim.cromie@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 2020-06-13 09:57:21, Jim Cromie wrote: > ddebug_describe_flags currently fills a caller provided string buffer, > after testing its size (also passed) in a BUG_ON. Fix this by > replacing them with a known-big-enough string buffer wrapped in a > struct, and passing that instead. > > Also simplify the flags parameter, and instead de-ref the flags struct > in the caller; this makes the function reusable (soon) where flags are > unpacked. In all patches is missing: Signed-off-by: Jim Cromie > --- > 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; #define FLAGS_BUF_SIZE (ARRAY_SIZE(opt_array) + 1) used as char flags_buf[FLAGS_BUF_SIZE]; Best Regards, Petr