From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762978AbbA3S3Z (ORCPT ); Fri, 30 Jan 2015 13:29:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45259 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751239AbbA3S3Y (ORCPT ); Fri, 30 Jan 2015 13:29:24 -0500 Date: Fri, 30 Jan 2015 19:28:05 +0100 From: Oleg Nesterov To: Dave Hansen Cc: dave.hansen@linux.intel.com, riel@redhat.com, sbsiddha@gmail.com, luto@amacapital.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, fenghua.yu@intel.com, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH 1/2] x86, fpu: wrap get_xsave_addr() to make it safer Message-ID: <20150130182805.GA20075@redhat.com> References: <20150130174309.D666B2A7@viggo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150130174309.D666B2A7@viggo.jf.intel.com> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/30, Dave Hansen wrote: > > +void *tsk_get_xsave_field(struct task_struct *tsk, int xsave_field) > +{ > + union thread_xstate *xstate; > + > + unlazy_fpu(tsk); ack, but to remind this depends on 2/3 I sent. > + xstate = tsk->thread.fpu.state; > + /* > + * This might be unallocated if the FPU > + * was never in use. > + */ > + if (!xstate) > + return NULL; This is cosmetic, unlazy_fpu() is safe if !xstate, __thread_has_fpu() is not possible in this case. But perhaps if (!used_math()) return NULL; will look better. Oleg.