From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E246EC43381 for ; Thu, 7 Mar 2019 12:22:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A68B320675 for ; Thu, 7 Mar 2019 12:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551961342; bh=ynE0VxeCHai49aImohNiSAk6t90UT02QaprWw81UDBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=GQRkRNHGiHFfVQxPRx3xM53JvIJAtPqXGiOAOwILYtcQgMZiBNqbKSLiYHI9B8AR9 pv6BFC5bNhP42F87pmM60URhxo0KKLGeZaPICRRV59XztO8hQ8KZld1iHkQbF4ummT mC5BFAY7z621mJ+ppDMF7mPT07Yw7oGcIeeGr0Y8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726172AbfCGMWW (ORCPT ); Thu, 7 Mar 2019 07:22:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:54068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726101AbfCGMWW (ORCPT ); Thu, 7 Mar 2019 07:22:22 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C78BD20675; Thu, 7 Mar 2019 12:22:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551961341; bh=ynE0VxeCHai49aImohNiSAk6t90UT02QaprWw81UDBs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D+vYozu39G5XoOBp6TtVXyI6JdBnRSqxn3pNkYoFpjF6kdaZ5PXYq7m4UDWixdKJg QC+2YYzBdvDkX3nondC25oSylnsgJEpHOg6Wmz7P1eirMJQQdA8nRoumY9ItbvhfHd v7DzYPJedArErsz3BfxsYk+WwZrYL3WzlsNBSs3I= Date: Thu, 7 Mar 2019 13:22:18 +0100 From: Greg KH To: Viresh Kumar Cc: "4 . 0+" , linux-pm@vger.kernel.org, Vincent Guittot Subject: Re: [PATCH 4.0+] cpufreq: Use struct kobj_attribute instead of struct global_attr Message-ID: <20190307122218.GC21325@kroah.com> References: <4f8ea1c92397b7d88aa8e0fe825b3e14b70ef85c.1551957797.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4f8ea1c92397b7d88aa8e0fe825b3e14b70ef85c.1551957797.git.viresh.kumar@linaro.org> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Thu, Mar 07, 2019 at 04:53:33PM +0530, Viresh Kumar wrote: > commit 625c85a62cb7d3c79f6e16de3cfa972033658250 upstream. > > The cpufreq_global_kobject is created using kobject_create_and_add() > helper, which assigns the kobj_type as dynamic_kobj_ktype and show/store > routines are set to kobj_attr_show() and kobj_attr_store(). > > These routines pass struct kobj_attribute as an argument to the > show/store callbacks. But all the cpufreq files created using the > cpufreq_global_kobject expect the argument to be of type struct > attribute. Things work fine currently as no one accesses the "attr" > argument. We may not see issues even if the argument is used, as struct > kobj_attribute has struct attribute as its first element and so they > will both get same address. > > But this is logically incorrect and we should rather use struct > kobj_attribute instead of struct global_attr in the cpufreq core and > drivers and the show/store callbacks should take struct kobj_attribute > as argument instead. > > This bug is caught using CFI CLANG builds in android kernel which > catches mismatch in function prototypes for such callbacks. > > Cc: 4.0+ # 4.0+ > Reported-by: Donghee Han > Reported-by: Sangkyu Kim > Signed-off-by: Viresh Kumar > Signed-off-by: Rafael J. Wysocki > --- > This needs to be applied from v4.0 to v4.5 (including both). Does not apply to 4.4.y either :( greg k-h