Received: by 10.213.65.68 with SMTP id h4csp3992497imn; Tue, 10 Apr 2018 07:41:16 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+7rR0ZAmIcH/DKOw3I/q6bUq/NK4iQ+bTE2r6EILGcM1nPEeE8lt+xPBUKnJAAnqcYstuh X-Received: by 2002:a17:902:74c3:: with SMTP id f3-v6mr733071plt.7.1523371276159; Tue, 10 Apr 2018 07:41:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523371276; cv=none; d=google.com; s=arc-20160816; b=IPNdnnBwMQ9CJUNrcCnbdoFJifHYPWI6zktczvOzV+FmnsO0N30sjdxDohYecHAjsE UnvOzYOj9xLg/3lkgMvKvTNY0+AE2EO/+RFTuVM+HkXXqe9cxmyeSXTkTyuJKOC9gM48 5mMkniT6u/XZGERwhURZDfE8gCrG3bfI+qhqnCjHmOw8GCg14t9GPYE1X/59oUJx6NWC pPqBhWQUYqpEAyM6YzsRqIjR0nYEJEoz4nP9jMJB0RRyYk6iOdPSeRsXY2Kylh884JvC kn+xA0EMxsuvPesxwWrPVuBBkf0tSAPVMst5pFCGeDpDchqqnM9vx9ajCQWA81KxarSL oYTQ== 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:arc-authentication-results; bh=HnY+xK28BtBBYbvoyjZwF6MQB5zn/DBetwci16jL0Cg=; b=STY3V/dCCdj5B/hT8AqZy1bQVLRnu+VKYcszVz5kISgTiuJkbggZQEzvIpB6hG0YbT gJShF6RoURsw1n193xTGjwORVzTggeUEZtpe++PwU+EWa1t/FRbkOcqi1b81d/w6BaFD FSBdX7FQXaIho9xICnahWmhzNaeJNqrl07LKwXVPUpgrARNyNRTPmXCZmqgalb/jJZzp x45yhi/C+PsGbPBxr7kbLHb8iTJlhpsNdaKaS9zYTFdT5r4MV4KQDLhMneujEKhEq6RH A30hdBGLZ8NB/AJgr1aPChlga83rXMDB6W3WrZYqu0sTlrbYR7ljMjNE4MeL41S7trUd mH2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m20-v6si2856848pli.164.2018.04.10.07.40.39; Tue, 10 Apr 2018 07:41:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754217AbeDJOgD (ORCPT + 99 others); Tue, 10 Apr 2018 10:36:03 -0400 Received: from mx2.suse.de ([195.135.220.15]:56689 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753345AbeDJOgB (ORCPT ); Tue, 10 Apr 2018 10:36:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 59F23AFBA; Tue, 10 Apr 2018 14:36:00 +0000 (UTC) Date: Tue, 10 Apr 2018 16:35:59 +0200 From: Petr Mladek To: Joe Perches Cc: Martin Schwidefsky , Heiko Carstens , linux-s390@vger.kernel.org, LKML , Rasmus Villemoes Subject: Re: s390: defective uses of va_arg in __debug_sprintf_event Message-ID: <20180410143559.wlt5sfb2t24q6g3g@pathway.suse.cz> References: <1523041723.6127.33.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1523041723.6127.33.camel@perches.com> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 2018-04-06 12:08:43, Joe Perches wrote: > And I found this when looking at another defect > in debug_sprintf_event where a %p extension > is unintentionally used via a string concatenation. > as pointed out by Rasmus Villemoes > --- > arch/s390/kernel/perf_cpum_sf.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c > index 1c9ddd7aa5ec..1c449a6f841a 100644 > --- a/arch/s390/kernel/perf_cpum_sf.c > +++ b/arch/s390/kernel/perf_cpum_sf.c > @@ -212,9 +212,7 @@ static int realloc_sampling_buffer(struct sf_buffer *sfb, > * the sampling buffer origin. > */ > if (sfb->sdbt != get_next_sdbt(tail)) { > - debug_sprintf_event(sfdbg, 3, "realloc_sampling_buffer: " > - "sampling buffer is not linked: origin=%p" > - "tail=%p\n", > + debug_sprintf_event(sfdbg, 3, "realloc_sampling_buffer: sampling buffer is not linked: origin=%p tail=%p\n", > (void *) sfb->sdbt, (void *) tail); > return -EINVAL; > } This concatenation fix is correct. %p has many possible specifiers. The code takes a simple approach and substitute "%ptail" with the pointer value. See the following code in vsnprintf(): case FORMAT_TYPE_PTR: str = pointer(fmt, str, end, va_arg(args, void *), spec); while (isalnum(*fmt)) fmt++; break; We might debate if vsprintf() should handle this better. Anyway, there is a missing space in the above debug_sprintf_event() call. Joe, are you going to send this as a separate patch, your SOB, ...? Best Regards, Petr