Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp2990lqt; Sun, 17 Mar 2024 21:46:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwjcaCTu4V/K/8k/E+pMPgUwQefTdVXCcZZw0AQ/JFczgJObW3aJNNt6deMVi0EBte7sQW4XtmboEoGBsIOyGKqIwkV4EZ315vZ4aOLA== X-Google-Smtp-Source: AGHT+IGnkZg1TgvneJJrvFIF2+QLhWNhxDtAbxn8i9HTtGrhrw7Ph4xuSCIiOdvUbZy8m0L1c5VI X-Received: by 2002:a0d:ea4c:0:b0:609:239a:d0fc with SMTP id t73-20020a0dea4c000000b00609239ad0fcmr9775049ywe.38.1710737187696; Sun, 17 Mar 2024 21:46:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710737187; cv=pass; d=google.com; s=arc-20160816; b=Iucoa1jOpqJsnnqwxR1y5w4eawhA7Y32LNZE/WjGJZNH6Lr4Y1rWUk9flby3S4c6Qq 4bcDHbxrDjjwCXoWeR3RLtsI/ModC7sNFUS3NBxUJ3oO+IyA/ZYAc0V2OEWnPwTpb2oH 8P4eFJD1hxQq2fjo4k9hHPyit6PblKmRO1RdU3UjK7M3VLd+bxTeBfl9BtXaAqTyRSwa 3K3zIuNq3MaFGfhU6hPmXoWx91yT3C6qEURHYhEDblPFXTOrm7Dq32qhPfuoziA2I99E yiD2NBtydwA8FcFsNykBHGA8PfWzpiZoGiZOAIQhwUud1YpW5nA8/KPi07KFciD99Vtn rO9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:to:from:date:feedback-id:dkim-signature :dkim-signature; bh=xhipH5R8dCuM4+XsucMJnjuzsIp1WFZtYIsfPrV6uAk=; fh=bWdvrdouhlOmn+GJChwpM09S7h+zuUqPVA/waAb4I1M=; b=mzqHrihrPe2NJvjKW7MWBtAt1wWsy00Ljz1otgPj4ORem7njuV/O8NAQd1/GjNPL6j bhxbu6wn+kCFV7JvRxG3jKIaBIMNSz+bTbvkTkMONfI5G/we/5JmRb//bisfdC4InomI g+hXf5txRxhEtnZxzF0lU1fowRZ/xI8wOO2bFotzgY8Y6fmYMptUuLx6T2/QAYh2i66i 8rIULgxA1ym+8NE0sBb8y5VAs/wFDVVAa+wjQa+Koqz525cccYlCEsZEkgHICG0vtaPZ je4/MD0041kAO2RVE/FHyE4jTWyMYnlj3km+ajn7Aq9U7ip6hQtHuvkdgM4TKDy8tnE1 e6rw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=CeNRQD4N; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cKHwx+kv; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-105696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a18-20020ac85b92000000b00430b482ee09si5816748qta.620.2024.03.17.21.46.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Mar 2024 21:46:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-105696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sakamocchi.jp header.s=fm2 header.b=CeNRQD4N; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=cKHwx+kv; arc=pass (i=1 spf=pass spfdomain=sakamocchi.jp dkim=pass dkdomain=sakamocchi.jp dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sakamocchi.jp); spf=pass (google.com: domain of linux-kernel+bounces-105696-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-105696-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sakamocchi.jp Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B1E5B1C20C15 for ; Mon, 18 Mar 2024 04:46:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 251E81B966; Mon, 18 Mar 2024 04:46:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="CeNRQD4N"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="cKHwx+kv" Received: from wfout6-smtp.messagingengine.com (wfout6-smtp.messagingengine.com [64.147.123.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99992208A8 for ; Mon, 18 Mar 2024 04:46:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.149 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710737178; cv=none; b=PyhDOGnd3f+asqvqnwcbVAnZSztl2pJuymW8m1nlBP2ZXmHG7vqsGV1jr51j+gWD28ol4lXFA/T0z2ghFsgb+YjAmQFavXyyqkOnpl7r4/kgzcqJTa4O76NrRuNGmltOQbPFxu02ZMMxe99EI92RIXWT0Wh2nmytzAjUGSYgfaM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710737178; c=relaxed/simple; bh=zlUcRY/+h5uE2xqKt7oW8gRWIW5IbgRjWeZszpx+Aoo=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=n6J5lUPbzZwmyMgFfhFy8No8zwh1hdyVUDCIcdYVj6sZtyLmfWHLA7Pot9yS1zWrU0WbVX5jr3IWdBD+Vt3G/gLGWThs3x3ZiuKFHjuaI8Iw9bbiFnm5DCu7lMn887YxSWkCJp/oFQziC+y2sIfcL4buKYGxEqekEoadVDl9FQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=CeNRQD4N; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=cKHwx+kv; arc=none smtp.client-ip=64.147.123.149 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id 4577E1C000B9; Mon, 18 Mar 2024 00:46:14 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 18 Mar 2024 00:46:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1710737173; x=1710823573; bh=xhipH5R8dC uM4+XsucMJnjuzsIp1WFZtYIsfPrV6uAk=; b=CeNRQD4NiHE18F6/sRelJJjZTn SGtLf29mrIwZV6SRIDQmZqjzsuWSccB8VzmO9v9NbGH1yN6PM/6EdJIO8S4AHL54 An+Abs/am2655XpiITrnJxT3VuvJNSBDR+sFXNbzHTM+SV/pCRlOlRxKch2i1JuJ 7r6IcvyLs/3ggQQ985DHizczhK1+zwlBxR1geRQgi7zd18z+INM52/FuZ2aAasYc j/XrO74Iyvy/BqUHuaoQZSWQGAFwH3KDI8G/vT9DijrE+HgfRS+udFHH0FEwZLsz CdD7ZpB5aPAF4Wsb3uks9sQISlvC7oCwdjGeV2dS+VHEjogg8TcSrUpIBaSA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1710737173; x=1710823573; bh=xhipH5R8dCuM4+XsucMJnjuzsIp1 WFZtYIsfPrV6uAk=; b=cKHwx+kvtdwvLsL9zol1O5iwU5QaXpxO3F9N0t0AD/k1 /k4YbvBrHHTc9aly9woJRjd/8xTLoaxEso905WlXNUKVrr+V5Z7Wlck8JSkLriF8 bIYOF/WAq8FjC7nqyLNjZr5DqoZbaak3bFUroJa5hjRbd5V9p58NeuD2VRq9O7xi bVCdR5uqBn/qjLCk7Q7qsExR4Z3Fm+gfnrVVwcwri++v2iQKpC3ndKXLDkDvRw+K HQrJufsEO7Zx8T2q4SLzs9YAMw4CJViETn7eLeuhnR2XVJxJSYPDWRLeV+Hf9S04 ZvJiJd7fx1ytpCskjzqOxoLu0vztPRt3drf2IPzzQA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrkeeigdejhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepvfgrkhgrshhh ihcuufgrkhgrmhhothhouceoohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph eqnecuggftrfgrthhtvghrnheplefhueegvdejgfejgfdukeefudetvddtuddtueeivedt tdegteejkedvfeegfefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrg hilhhfrhhomhepohdqthgrkhgrshhhihesshgrkhgrmhhotggthhhirdhjph X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Mar 2024 00:46:12 -0400 (EDT) Date: Mon, 18 Mar 2024 13:46:09 +0900 From: Takashi Sakamoto To: Li Zhijian , linux-kernel@vger.kernel.org, linux1394-devel@lists.sourceforge.net Subject: Re: [PATCH 1/2] firewire: Kill unnecessary buf check in device_attribute.show Message-ID: <20240318044609.GA659599@workstation.local> Mail-Followup-To: Li Zhijian , linux-kernel@vger.kernel.org, linux1394-devel@lists.sourceforge.net References: <20240122053942.80648-1-lizhijian@fujitsu.com> <20240122085604.GA254251@workstation.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240122085604.GA254251@workstation.local> Hi, On Mon, Jan 22, 2024 at 05:56:04PM +0900, Takashi Sakamoto wrote: > Hi, > > On Mon, Jan 22, 2024 at 01:39:41PM +0800, Li Zhijian wrote: > > Per Documentation/filesystems/sysfs.rst: > > > sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the > > > method. > > > > So we can kill the unnecessary buf check safely. > > > > Signed-off-by: Li Zhijian > > --- > > drivers/firewire/core-device.c | 14 +++----------- > > 1 file changed, 3 insertions(+), 11 deletions(-) > > Applied both patches to linux-next branch, since they are not so-urgent > fixes. I realized that it causes an issue at the path to initialize device structure for node in IEEE 1394 bus. (drivers/firewire/core-device.c) fw_device_init() / fw_device_refresh() ->create_units() ->init_fw_attribute_group() ->attr->show(dev, attr, NULL) kernel: ------------[ cut here ]------------ kernel: invalid sysfs_emit: buf:0000000000000000 kernel: WARNING: CPU: 5 PID: 647501 at fs/sysfs/file.c:747 sysfs_emit+0xb5/0xc0 kernel: Modules linked in: snd_fireworks(OE) snd_firewire_lib(OE) firewire_ohci(OE) firewire_core(OE) cfg80211 veth nft_masq crc_itu_t vfio_pci vfio_pci_core vfio_iommu_type1 vfio iommufd rpcsec_gss_krb5 nfsv4 nfs netfs snd_seq_dummy sn> kernel: crypto_simd asus_wmi snd_timer ledtrig_audio cryptd cec sparse_keymap nls_iso8859_1 rapl platform_profile wmi_bmof k10temp i2c_piix4 snd rc_core i2c_algo_bit ccp soundcore zfs(PO) spl(O) input_leds joydev cdc_mbim cdc_wdm mac_h> kernel: CPU: 5 PID: 647501 Comm: kworker/5:0 Tainted: P W OE 6.8.0-11-generic #11-Ubuntu kernel: Hardware name: System manufacturer System Product Name/TUF GAMING X570-PLUS, BIOS 5003 10/07/2023 kernel: Workqueue: firewire fw_device_workfn [firewire_core] kernel: RIP: 0010:sysfs_emit+0xb5/0xc0 kernel: Code: 25 28 00 00 00 75 29 c9 31 d2 31 c9 31 f6 31 ff 45 31 c0 45 31 c9 e9 5a 89 c7 00 48 89 fe 48 c7 c7 64 06 3f bd e8 1b 80 b4 ff <0f> 0b 31 c0 eb c7 e8 a0 ea c5 00 90 90 90 90 90 90 90 90 90 90 90 kernel: RSP: 0018:ffffacd857103cd0 EFLAGS: 00010246 kernel: RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 kernel: RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 kernel: RBP: ffffacd857103d20 R08: 0000000000000000 R09: 0000000000000000 kernel: R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000010000 kernel: R13: ffffffffc28e2ff8 R14: 0000000000000000 R15: 0000000000000001 kernel: FS: 0000000000000000(0000) GS:ffff918190080000(0000) knlGS:0000000000000000 kernel: CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 kernel: CR2: 00007835dca0b048 CR3: 00000003cb898000 CR4: 00000000003506f0 kernel: Call Trace: kernel: kernel: ? show_regs+0x6d/0x80 kernel: ? __warn+0x89/0x160 kernel: ? sysfs_emit+0xb5/0xc0 kernel: ? report_bug+0x17e/0x1b0 kernel: ? handle_bug+0x51/0xa0 kernel: ? exc_invalid_op+0x18/0x80 kernel: ? asm_exc_invalid_op+0x1b/0x20 kernel: ? sysfs_emit+0xb5/0xc0 kernel: show_immediate+0x13f/0x1d0 [firewire_core] kernel: init_fw_attribute_group+0x81/0x150 [firewire_core] kernel: create_units+0x119/0x160 [firewire_core] kernel: fw_device_init+0x1a9/0x330 [firewire_core] kernel: fw_device_workfn+0x12/0x20 [firewire_core] kernel: process_one_work+0x16f/0x350 kernel: worker_thread+0x306/0x440 kernel: ? __pfx_worker_thread+0x10/0x10 kernel: kthread+0xf2/0x120 kernel: ? __pfx_kthread+0x10/0x10 kernel: ret_from_fork+0x47/0x70 kernel: ? __pfx_kthread+0x10/0x10 kernel: ret_from_fork_asm+0x1b/0x30 kernel: kernel: ---[ end trace 0000000000000000 ]--- kernel: ------------[ cut here ]------------ Furthermore, 'show_text_leaf()' returns negative value when the NULL pointer is passed. It results in the lack of vendor/model names from sysfs. I absolutely overlooked them. I would like to fix them within this merge window, or revert them as a last resort... Regards Takashi Sakamoto