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=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 F1C96C43381 for ; Thu, 7 Mar 2019 12:20:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B80A120675 for ; Thu, 7 Mar 2019 12:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551961214; bh=zHciOBoGJYlo6cEMFKwaQo/gLkgkQQIKC7jGd+Kxw/c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=vj5LXeE0n7Ze7uqZxaFqceJ5iyQH2qb4WLeCuyZAn+hw6Z/2Cw8yIuZGfddkkSlb1 4cb7TFyxMAqXza/JjRWWzNoEZrZSYD29NeOd+yCPXlWviX0J1qUYlKLEAerYU7bOEO JBuc+gHC2+oaIXhBZttsfYkCMna6eXWUSOoPZNvk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726200AbfCGMUO (ORCPT ); Thu, 7 Mar 2019 07:20:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:52906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726127AbfCGMUO (ORCPT ); Thu, 7 Mar 2019 07:20:14 -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 2643020675; Thu, 7 Mar 2019 12:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551961213; bh=zHciOBoGJYlo6cEMFKwaQo/gLkgkQQIKC7jGd+Kxw/c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=p0tRdNTrgDSSD3K3td+xCVT1GLTu36JAmhdZCo0bEU+AYeaonhJXqhJuy5yIL8Hz8 hMPIPWFWbI6A1wIhDi6fS1vAyenlDtJ8Clhn1wDP27gvw1OnhbRmO9ZPn/vgNqjVDp d8+gcrVuXvIkHIsRNfcp6FUXi78WhQXdH1rfBz7w= Date: Thu, 7 Mar 2019 13:20:11 +0100 From: Greg KH To: Viresh Kumar Cc: "4 . 10" , linux-pm@vger.kernel.org, Vincent Guittot Subject: Re: [PATCH v4.10] cpufreq: Use struct kobj_attribute instead of struct global_attr Message-ID: <20190307122011.GA21325@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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:52:20PM +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.10 # 4.10 Why 4.10? that's a long-dead kernel version :(