Patchwork ext4: signedness bug breaks ext4_inode_touch_time_cmp()

login
register
mail settings
Submitter Dan Carpenter
Date June 20, 2013, 8:08 a.m.
Message ID <20130620080858.GA15095@elgon.mountain>
Download mbox | patch
Permalink /patch/252791/
State Superseded
Headers show

Comments

Dan Carpenter - June 20, 2013, 8:08 a.m.
"diff" is unsigned so this doesn't sort the LRU list correctly.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This was introduced in 6480bad916be "ext4: improve extent cache shrink
mechanism to avoid to burn CPU time"

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Zheng Liu - June 20, 2013, 3:21 p.m.
On Thu, Jun 20, 2013 at 11:08:58AM +0300, Dan Carpenter wrote:
> "diff" is unsigned so this doesn't sort the LRU list correctly.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for fixing it.

Regards,
                                                - Zheng

> ---
> This was introduced in 6480bad916be "ext4: improve extent cache shrink
> mechanism to avoid to burn CPU time"
> 
> diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
> index e0190f6..79e097d 100644
> --- a/fs/ext4/extents_status.c
> +++ b/fs/ext4/extents_status.c
> @@ -880,7 +880,7 @@ static int ext4_inode_touch_time_cmp(void *priv, struct list_head *a,
>  				     struct list_head *b)
>  {
>  	struct ext4_inode_info *eia, *eib;
> -	unsigned long diff;
> +	long diff;
>  
>  	eia = list_entry(a, struct ext4_inode_info, i_es_lru);
>  	eib = list_entry(b, struct ext4_inode_info, i_es_lru);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/extents_status.c b/fs/ext4/extents_status.c
index e0190f6..79e097d 100644
--- a/fs/ext4/extents_status.c
+++ b/fs/ext4/extents_status.c
@@ -880,7 +880,7 @@  static int ext4_inode_touch_time_cmp(void *priv, struct list_head *a,
 				     struct list_head *b)
 {
 	struct ext4_inode_info *eia, *eib;
-	unsigned long diff;
+	long diff;
 
 	eia = list_entry(a, struct ext4_inode_info, i_es_lru);
 	eib = list_entry(b, struct ext4_inode_info, i_es_lru);