Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2452490pxb; Thu, 11 Feb 2021 12:44:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxNdd5HRBzInclW5VPyEf6Z/s16jn4DAyP+Bbh7wdSnXCm/vFMPiUV4UbMGan9tkDcIxdUp X-Received: by 2002:a17:906:555:: with SMTP id k21mr10073427eja.148.1613076285586; Thu, 11 Feb 2021 12:44:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613076285; cv=none; d=google.com; s=arc-20160816; b=04XkRUMpEOd3N49NFd90E5hD9SA8pJRtuVR9nNokcCBDBGwhw5f+hePbHrajYxcI71 g7qJxSrPah5pjkQtrgFiTLwD4ZGHPMbE93tI97a+P/8zkvt4SkSk//ZmJ/Vva9s722bg n04awMA0JK+JtvOePNhMWgPteBuyTIHMAzu12M9kysubLEhhSm+ErgzoF4NLdWXoYGlI 3ubCw7VFq/4Kyju2bx2mlO3J9X35IpNec1fygzyLXhSKUO875gWofC1MzOoER1nxxaZW NmhXjpKMnjxn33W+hdLAd1r9kHiHZp3QQJDMPpMaCdqZL9HEDL4rEt4/GIee78zwdg/7 lOIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=JqZZZvFE5VxL++dFfoZprDhk9+CSenhmKTyUPdyCU/U=; b=V4K5+1TbKmF0O451HRm7h7SVLNrinf2BnN3JpAuBDdCyvUuYk+gGqVtpyOb1+Lkeg6 nCm7XOgDq6y/Ntc87SFf5J/BJ1FYEb0hG32ULVYSQnWfhk7hoLxOyuZbM3tlcPsPO6x5 hbmFSwK0NSc2x15F0VsMkXfMxuq8bCEK5tIg5adxaGOHp0Mk3eRvIJ3LsDCFr21TStv0 6rkIjPLfoAJgLvVomTD2sh0aNpk7xAR3XL43z9+ZIA1Cs2T+CFhFJAbeiYNUaQQG8pLD Tj0HsFLBYm611tcWwYMsPrqS3PwFUlSEkdYCX4fMo17fE2mb76oOW9ziV5hDWyUHjC5f mLsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JwpYmrz5; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr11si4394453ejb.670.2021.02.11.12.44.22; Thu, 11 Feb 2021 12:44:45 -0800 (PST) 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=@google.com header.s=20161025 header.b=JwpYmrz5; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbhBKUmJ (ORCPT + 99 others); Thu, 11 Feb 2021 15:42:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229918AbhBKUmG (ORCPT ); Thu, 11 Feb 2021 15:42:06 -0500 Received: from mail-ua1-x92c.google.com (mail-ua1-x92c.google.com [IPv6:2607:f8b0:4864:20::92c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CA87C061574 for ; Thu, 11 Feb 2021 12:41:26 -0800 (PST) Received: by mail-ua1-x92c.google.com with SMTP id g5so2182778uak.10 for ; Thu, 11 Feb 2021 12:41:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JqZZZvFE5VxL++dFfoZprDhk9+CSenhmKTyUPdyCU/U=; b=JwpYmrz5Pq9isvSseBiUCn4eQXQyfBr2OxOXWrBy7tw8o+XYqRFK+R2ucZp0cFdhaK A4sSR+eNIBHOfYKj7ZwwWoMNYH1qP8OtXTYlKygnib3yOBIkWMO2BAsEd4R0rZWVDrU4 UQB2CNI9KgTkaZW/msOwTE9FUsXlVrt18/mRJUzfFqEXYlrgLt0Vxwx1wDYe7v4b0wKV rJ9yO9NLkvzKJHpcirJ1nQVtIIu9dUAgZPIFkDx86PTwZf6zFB8pXXDqiVLhBjiSGy1W 3Txd7anedzyRr7l070exCjtnnQVhSA6MSHFx8e3l2nPByd1zdHNBPvjCE2cIpGXPRd8K kGQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JqZZZvFE5VxL++dFfoZprDhk9+CSenhmKTyUPdyCU/U=; b=tSiTCP9WkCSvf14Gc9wFf/zNHs+If3542uQe+k0G1I/h0lKnYtcSP1BWBLLqE/LjQU WoYAv9LBBYwB8poEUL/kDYW3pPKTl37vnqgOBmtPSEnqLynYRS1ZHz2BgK3JZO2rZEOi 3MtiOjApoWEpwymYOv+FE9Mmz/l2rToJCnu8yjmnk9CWVXUGv03Q/7Yxoz+TvZm9YtW/ or50aP3Pl62zjnVKvvCABjbQ5JBhALCzDf2VL1POCrR7c+hzctQPJY5/bFEa8W0e1jXd 7NafS5INuKAVFpTPq0jnZnjB50AQXy1RARb1WjB8Jmwo0TJhf8QPBspp/Et7LboKU5RX K3GA== X-Gm-Message-State: AOAM531/uIVrsUpScZ1fCtdeoQUvd5BQVhKIdQ9vxsavh2eGJN/Y87G8 voH1eKeUeQoSRaPWTJeF8w6U/O6+MWrLJh37+kp0aA== X-Received: by 2002:ab0:2448:: with SMTP id g8mr6669684uan.89.1613076085437; Thu, 11 Feb 2021 12:41:25 -0800 (PST) MIME-Version: 1.0 References: <20210211194258.4137998-1-nathan@kernel.org> In-Reply-To: <20210211194258.4137998-1-nathan@kernel.org> From: Sami Tolvanen Date: Thu, 11 Feb 2021 12:41:14 -0800 Message-ID: Subject: Re: [PATCH] qemu_fw_cfg: Make fw_cfg_rev_attr a proper kobj_attribute To: Nathan Chancellor Cc: Gabriel Somlo , "Michael S. Tsirkin" , Nick Desaulniers , Kees Cook , qemu-devel@nongnu.org, LKML , clang-built-linux Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nathan, On Thu, Feb 11, 2021 at 11:43 AM Nathan Chancellor wrote: > > fw_cfg_showrev() is called by an indirect call in kobj_attr_show(), > which violates clang's CFI checking because fw_cfg_showrev()'s second > parameter is 'struct attribute', whereas the ->show() member of 'struct > kobj_structure' expects the second parameter to be of type 'struct > kobj_attribute'. > > $ cat /sys/firmware/qemu_fw_cfg/rev > 3 > > $ dmesg | grep "CFI failure" > [ 26.016832] CFI failure (target: fw_cfg_showrev+0x0/0x8): > > Fix this by converting fw_cfg_rev_attr to 'struct kobj_attribute' where > this would have been caught automatically by the incompatible pointer > types compiler warning. Update fw_cfg_showrev() accordingly. > > Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg device") > Link: https://github.com/ClangBuiltLinux/linux/issues/1299 > Signed-off-by: Nathan Chancellor Looks good to me. Thank you for sending the patch! Reviewed-by: Sami Tolvanen Sami