* [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
@ 2020-03-16 15:31 Darrick J. Wong
2020-03-16 15:34 ` Brian Foster
2020-03-17 18:34 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2020-03-16 15:31 UTC (permalink / raw)
To: xfs; +Cc: Brian Foster
From: Darrick J. Wong <darrick.wong@oracle.com>
When I lifted the code in xfs_alloc_ag_vextent_lastblock out of a loop,
I forgot to convert all the accesses to len to be pointer dereferences.
Coverity-id: 1457918
Fixes: 5113f8ec3753ed ("xfs: clean up weird while loop in xfs_alloc_ag_vextent_near")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 337822115bbc..203e74fa64aa 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(
* maxlen, go to the start of this block, and skip all those smaller
* than minlen.
*/
- if (len || args->alignment > 1) {
+ if (*len || args->alignment > 1) {
acur->cnt->bc_ptrs[0] = 1;
do {
error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
2020-03-16 15:31 [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock Darrick J. Wong
@ 2020-03-16 15:34 ` Brian Foster
2020-03-17 18:34 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Brian Foster @ 2020-03-16 15:34 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs
On Mon, Mar 16, 2020 at 08:31:55AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> When I lifted the code in xfs_alloc_ag_vextent_lastblock out of a loop,
> I forgot to convert all the accesses to len to be pointer dereferences.
>
> Coverity-id: 1457918
> Fixes: 5113f8ec3753ed ("xfs: clean up weird while loop in xfs_alloc_ag_vextent_near")
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> fs/xfs/libxfs/xfs_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 337822115bbc..203e74fa64aa 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(
> * maxlen, go to the start of this block, and skip all those smaller
> * than minlen.
> */
> - if (len || args->alignment > 1) {
> + if (*len || args->alignment > 1) {
> acur->cnt->bc_ptrs[0] = 1;
> do {
> error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock
2020-03-16 15:31 [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock Darrick J. Wong
2020-03-16 15:34 ` Brian Foster
@ 2020-03-17 18:34 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-03-17 18:34 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: xfs, Brian Foster
On Mon, Mar 16, 2020 at 08:31:55AM -0700, Darrick J. Wong wrote:
> diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
> index 337822115bbc..203e74fa64aa 100644
> --- a/fs/xfs/libxfs/xfs_alloc.c
> +++ b/fs/xfs/libxfs/xfs_alloc.c
> @@ -1514,7 +1514,7 @@ xfs_alloc_ag_vextent_lastblock(
> * maxlen, go to the start of this block, and skip all those smaller
> * than minlen.
> */
> - if (len || args->alignment > 1) {
> + if (*len || args->alignment > 1) {
> acur->cnt->bc_ptrs[0] = 1;
> do {
> error = xfs_alloc_get_rec(acur->cnt, bno, len, &i);
The change definitivelly restores the old behavior. Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-17 18:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-16 15:31 [PATCH] xfs: fix incorrect test in xfs_alloc_ag_vextent_lastblock Darrick J. Wong
2020-03-16 15:34 ` Brian Foster
2020-03-17 18:34 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).