Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp852081pxk; Thu, 17 Sep 2020 19:05:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCOPQhh05o+bQQBtfnnKJ29F2jeWYmUsFKGMxfalI2rUEbMEigJYL0UuoXtfbFze6jgr34 X-Received: by 2002:a05:6402:292:: with SMTP id l18mr37228261edv.6.1600394725178; Thu, 17 Sep 2020 19:05:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394725; cv=none; d=google.com; s=arc-20160816; b=glUKvlgOpBxPt68u16e8vY+tmo1LIgBAg/45mV/5G7GtAF0O/l/RQJ2IhDoil5gBLa +Q/0Nbl5qDornZ7+OOOJJiOKb+5JqMaS/3bmJ0Xbc+OX/Wmlb8EQ/oznoJ/4Ig9X2MzK j6HrLw6or64vkSke413mMSz5p83dPA5R8WTMwZedU/AJiw2KPXHruGni8H829gIaTa2d o1tcY1ArsHj0bYmLDcKRWSbsT7e5/ESorTpt7sZu8erSa6PXNx+6JsZfQcXisU9H27Ea mcQqtCRAvQtZZWCssr2/5wCxtDW+kuf71p5ozX/RqgT/d/fm4v+Ix+evCnfo0K8ZwTKy r+9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qKdPEEgggV7nFTnwa8MoQRi1g+7e4zSRwnjGu2arsoc=; b=PyiuEuLS8SCkIoXymTX7dVQ5lcMpXnqumd+ALsVULJTB3517XPuGk4h1ABwAdo1FWf RLxcjH4HkI01jpVguFH328t1MrfkE/dRJKGUi/bwtJNxKLhYj8TzGyuN87Cw+vGssWH9 thefAHOvXDP7L7sf3VtAKSYKI41qwrjZGFjWh9CtVk2WBfwXwhW3sqh3TyycvW72ffLm Kqbf/CJPj3weWfqv4KSLkjYP5rkMb3Uis+T/wBoBWnC8o3xGVluV1sBkoWVx5hPx3Ums LIZPk/gIH+8yWsfJ0M9+IZLr7Q94f1NeLpCVDHioQL7Fp9n32xqohD0mNN9pjGXh78l8 hxcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OjuaiFQN; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si1253940ejz.653.2020.09.17.19.05.02; Thu, 17 Sep 2020 19:05: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=@kernel.org header.s=default header.b=OjuaiFQN; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727007AbgIRCDN (ORCPT + 99 others); Thu, 17 Sep 2020 22:03:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:49140 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726989AbgIRCDL (ORCPT ); Thu, 17 Sep 2020 22:03:11 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6AD7F21973; Fri, 18 Sep 2020 02:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394591; bh=FyTZiqyP+z3Jchr1b9Ht22bUzYBfvQx5LLExmT3Xiqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OjuaiFQNA4ZeJposfeEpWyAJPwDl/96vr8HIkSmyA77hP/sewPKZnNMrAXbTg8gvk x0DSmj0oTlSVLayQp2PWAgmwNKrkjM/7VmqBnxCRZkjY9XtoJnBdjftG+h3FGOQB2/ 9ywcf3X8dFkGd8ZD5s++cfj5N02XR65NSr8f9VdU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Thomas Richter , Vasily Gorbik , Sasha Levin , linux-s390@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 099/330] s390/cpum_sf: Use kzalloc and minor changes Date: Thu, 17 Sep 2020 21:57:19 -0400 Message-Id: <20200918020110.2063155-99-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Richter [ Upstream commit 32dab6828c42f087439d3e2617dc7283546bd8f7 ] Use kzalloc() to allocate auxiliary buffer structure initialized with all zeroes to avoid random value in trace output. Avoid double access to SBD hardware flags. Signed-off-by: Thomas Richter Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/perf_cpum_sf.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 229e1e2f8253a..996e447ead3a6 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1429,8 +1429,8 @@ static int aux_output_begin(struct perf_output_handle *handle, idx = aux->empty_mark + 1; for (i = 0; i < range_scan; i++, idx++) { te = aux_sdb_trailer(aux, idx); - te->flags = te->flags & ~SDB_TE_BUFFER_FULL_MASK; - te->flags = te->flags & ~SDB_TE_ALERT_REQ_MASK; + te->flags &= ~(SDB_TE_BUFFER_FULL_MASK | + SDB_TE_ALERT_REQ_MASK); te->overflow = 0; } /* Save the position of empty SDBs */ @@ -1477,8 +1477,7 @@ static bool aux_set_alert(struct aux_buffer *aux, unsigned long alert_index, te = aux_sdb_trailer(aux, alert_index); do { orig_flags = te->flags; - orig_overflow = te->overflow; - *overflow = orig_overflow; + *overflow = orig_overflow = te->overflow; if (orig_flags & SDB_TE_BUFFER_FULL_MASK) { /* * SDB is already set by hardware. @@ -1712,7 +1711,7 @@ static void *aux_buffer_setup(struct perf_event *event, void **pages, } /* Allocate aux_buffer struct for the event */ - aux = kmalloc(sizeof(struct aux_buffer), GFP_KERNEL); + aux = kzalloc(sizeof(struct aux_buffer), GFP_KERNEL); if (!aux) goto no_aux; sfb = &aux->sfb; -- 2.25.1