mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ChenXiaoSong <chenxiaosong2@huawei.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>
Cc: Bart Van Assche <bvanassche@acm.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Aditya Garg <gargaditya08@live.com>, Jens Axboe <axboe@kernel.dk>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Jeff Layton <jlayton@kernel.org>, <hannes@cmpxchg.org>,
	"Theodore Y . Ts'o" <tytso@mit.edu>, <muchun.song@linux.dev>,
	Linux FS Devel <linux-fsdevel@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] hfsplus: fix uninit-value in hfsplus_delete_cat()
Date: Sat, 17 Dec 2022 10:20:39 +0800	[thread overview]
Message-ID: <ec9d07ba-431f-55eb-f3a8-b92f15193548@huawei.com> (raw)
In-Reply-To: <6B5CECB6-C620-479A-A8EC-817CCCD9ECBB@dubeyko.com>

在 2022/12/17 2:09, Viacheslav Dubeyko 写道>
> So, where is here hip->subfolders = 0; /* I am here */? Sorry, maybe I missed some email.
> 

1/2 patch do not show more detail about 'hip->subfolders ', you can 
apply the patchset to baseline and use '--unified' option to 'git show' 
more detail:

```shell
git am '1/2 of the patchset' # to baseline
git show 'commit of 1/2 patch' --unified=16 # specify 16 lines of 
context instead of the default 3 lines
```

then you can see more detail as follows:

```shell
...
-struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
-                               umode_t mode)
+void hfsplus_init_inode(struct hfsplus_inode_info *hip)
  {
-       struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
-       struct inode *inode = new_inode(sb);
-       struct hfsplus_inode_info *hip;
-
-       if (!inode)
-               return NULL;
-
-       inode->i_ino = sbi->next_cnid++;
-       inode_init_owner(&init_user_ns, inode, dir, mode);
-       set_nlink(inode, 1);
-       inode->i_mtime = inode->i_atime = inode->i_ctime = 
current_time(inode);
-
-       hip = HFSPLUS_I(inode);
         INIT_LIST_HEAD(&hip->open_dir_list);
         spin_lock_init(&hip->open_dir_lock);
         mutex_init(&hip->extents_lock);
         atomic_set(&hip->opencnt, 0);
         hip->extent_state = 0;
         hip->flags = 0;
         hip->userflags = 0;
         hip->subfolders = 0; /********* I am here *****************/
         memset(hip->first_extents, 0, sizeof(hfsplus_extent_rec));
         memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec));
         hip->alloc_blocks = 0;
         hip->first_blocks = 0;
         hip->cached_start = 0;
         hip->cached_blocks = 0;
         hip->phys_size = 0;
         hip->fs_blocks = 0;
         hip->rsrc_inode = NULL;
+}
+
+struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
+                               umode_t mode)
+{
+       struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb);
+       struct inode *inode = new_inode(sb);
+       struct hfsplus_inode_info *hip;
+
+       if (!inode)
+               return NULL;
+
+       inode->i_ino = sbi->next_cnid++;
+       inode_init_owner(&init_user_ns, inode, dir, mode);
+       set_nlink(inode, 1);
+       inode->i_mtime = inode->i_atime = inode->i_ctime = 
current_time(inode);
+
+       hip = HFSPLUS_I(inode);
+       hfsplus_init_inode(hip);
         if (S_ISDIR(inode->i_mode)) {
                 inode->i_size = 2;
                 sbi->folder_count++;
                 inode->i_op = &hfsplus_dir_inode_operations;
...
```

  reply	other threads:[~2022-12-17  2:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15  8:18 [PATCH v2 0/2] initialize 'struct hfsplus_inode_info' in hfsplus_iget() ChenXiaoSong
2022-12-15  8:18 ` [PATCH v2 1/2] hfsplus: introduce hfsplus_init_inode() helper ChenXiaoSong
2022-12-15  8:18 ` [PATCH v2 2/2] hfsplus: fix uninit-value in hfsplus_delete_cat() ChenXiaoSong
2022-12-15 19:03   ` Viacheslav Dubeyko
2022-12-16  1:16     ` ChenXiaoSong
2022-12-16 18:09       ` Viacheslav Dubeyko
2022-12-17  2:20         ` ChenXiaoSong [this message]
2023-01-13  3:43 ` [PATCH v2 0/2] initialize 'struct hfsplus_inode_info' in hfsplus_iget() ChenXiaoSong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec9d07ba-431f-55eb-f3a8-b92f15193548@huawei.com \
    --to=chenxiaosong2@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=gargaditya08@live.com \
    --cc=hannes@cmpxchg.org \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=slava@dubeyko.com \
    --cc=tytso@mit.edu \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®