* [PATCH 1/2] xfs: fix uninitialized error variables
@ 2019-02-25 17:41 Darrick J. Wong
2019-02-25 17:41 ` [PATCH 2/2] xfs: fix backwards endian conversion in scrub Darrick J. Wong
2019-02-25 17:53 ` [PATCH 1/2] xfs: fix uninitialized error variables Allison Henderson
0 siblings, 2 replies; 5+ messages in thread
From: Darrick J. Wong @ 2019-02-25 17:41 UTC (permalink / raw)
To: darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
smatch complained about some uninitialized error returns, so fix those.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
fs/xfs/libxfs/xfs_sb.c | 2 +-
fs/xfs/xfs_reflink.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index 4e5029c37966..77a3a4085de3 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -877,7 +877,7 @@ xfs_initialize_perag_data(
uint64_t bfreelst = 0;
uint64_t btree = 0;
uint64_t fdblocks;
- int error;
+ int error = 0;
for (index = 0; index < agcount; index++) {
/*
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index d42e3ef9050e..680ae7662a78 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -261,7 +261,7 @@ xfs_reflink_convert_cow_locked(
struct xfs_bmbt_irec got;
struct xfs_btree_cur *dummy_cur = NULL;
int dummy_logflags;
- int error;
+ int error = 0;
if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
return 0;
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] xfs: fix backwards endian conversion in scrub
2019-02-25 17:41 [PATCH 1/2] xfs: fix uninitialized error variables Darrick J. Wong
@ 2019-02-25 17:41 ` Darrick J. Wong
2019-02-25 18:09 ` Allison Henderson
2019-02-25 17:53 ` [PATCH 1/2] xfs: fix uninitialized error variables Allison Henderson
1 sibling, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2019-02-25 17:41 UTC (permalink / raw)
To: darrick.wong; +Cc: linux-xfs
From: Darrick J. Wong <darrick.wong@oracle.com>
Fix a backwards endian conversion of a constant.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
index 9d4e8293d37e..ddf06bfaa29d 100644
--- a/fs/xfs/scrub/agheader.c
+++ b/fs/xfs/scrub/agheader.c
@@ -399,7 +399,7 @@ xchk_agf_xref_cntbt(
if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
return;
if (!have) {
- if (agf->agf_freeblks != be32_to_cpu(0))
+ if (agf->agf_freeblks != cpu_to_be32(0))
xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
return;
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] xfs: fix uninitialized error variables
2019-02-25 17:41 [PATCH 1/2] xfs: fix uninitialized error variables Darrick J. Wong
2019-02-25 17:41 ` [PATCH 2/2] xfs: fix backwards endian conversion in scrub Darrick J. Wong
@ 2019-02-25 17:53 ` Allison Henderson
1 sibling, 0 replies; 5+ messages in thread
From: Allison Henderson @ 2019-02-25 17:53 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On 2/25/19 10:41 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> smatch complained about some uninitialized error returns, so fix those.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/libxfs/xfs_sb.c | 2 +-
> fs/xfs/xfs_reflink.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
>
> diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
> index 4e5029c37966..77a3a4085de3 100644
> --- a/fs/xfs/libxfs/xfs_sb.c
> +++ b/fs/xfs/libxfs/xfs_sb.c
> @@ -877,7 +877,7 @@ xfs_initialize_perag_data(
> uint64_t bfreelst = 0;
> uint64_t btree = 0;
> uint64_t fdblocks;
> - int error;
> + int error = 0;
>
> for (index = 0; index < agcount; index++) {
> /*
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index d42e3ef9050e..680ae7662a78 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -261,7 +261,7 @@ xfs_reflink_convert_cow_locked(
> struct xfs_bmbt_irec got;
> struct xfs_btree_cur *dummy_cur = NULL;
> int dummy_logflags;
> - int error;
> + int error = 0;
>
> if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got))
> return 0;
>
Looks fine to me. Thank you!!
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xfs: fix backwards endian conversion in scrub
2019-02-25 17:41 ` [PATCH 2/2] xfs: fix backwards endian conversion in scrub Darrick J. Wong
@ 2019-02-25 18:09 ` Allison Henderson
2019-02-25 18:15 ` Darrick J. Wong
0 siblings, 1 reply; 5+ messages in thread
From: Allison Henderson @ 2019-02-25 18:09 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On 2/25/19 10:41 AM, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> Fix a backwards endian conversion of a constant.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/scrub/agheader.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>
> diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> index 9d4e8293d37e..ddf06bfaa29d 100644
> --- a/fs/xfs/scrub/agheader.c
> +++ b/fs/xfs/scrub/agheader.c
> @@ -399,7 +399,7 @@ xchk_agf_xref_cntbt(
> if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
> return;
> if (!have) {
> - if (agf->agf_freeblks != be32_to_cpu(0))
> + if (agf->agf_freeblks != cpu_to_be32(0))
> xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
> return;
> }
>
Good catch. I suppose there's not as much need to do the conversion if
the value is 0? But I think the call helps to make clear that the value
is supposed to be in big endian.
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] xfs: fix backwards endian conversion in scrub
2019-02-25 18:09 ` Allison Henderson
@ 2019-02-25 18:15 ` Darrick J. Wong
0 siblings, 0 replies; 5+ messages in thread
From: Darrick J. Wong @ 2019-02-25 18:15 UTC (permalink / raw)
To: Allison Henderson; +Cc: linux-xfs
On Mon, Feb 25, 2019 at 11:09:14AM -0700, Allison Henderson wrote:
> On 2/25/19 10:41 AM, Darrick J. Wong wrote:
> > From: Darrick J. Wong <darrick.wong@oracle.com>
> >
> > Fix a backwards endian conversion of a constant.
> >
> > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> > ---
> > fs/xfs/scrub/agheader.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> >
> > diff --git a/fs/xfs/scrub/agheader.c b/fs/xfs/scrub/agheader.c
> > index 9d4e8293d37e..ddf06bfaa29d 100644
> > --- a/fs/xfs/scrub/agheader.c
> > +++ b/fs/xfs/scrub/agheader.c
> > @@ -399,7 +399,7 @@ xchk_agf_xref_cntbt(
> > if (!xchk_should_check_xref(sc, &error, &sc->sa.cnt_cur))
> > return;
> > if (!have) {
> > - if (agf->agf_freeblks != be32_to_cpu(0))
> > + if (agf->agf_freeblks != cpu_to_be32(0))
> > xchk_block_xref_set_corrupt(sc, sc->sa.agf_bp);
> > return;
> > }
> >
>
> Good catch. I suppose there's not as much need to do the conversion if the
> value is 0?
Yep. Fortunately, there's enough macro soup in cpu_to_be* (and all the
other endian conversion functions) to detect that the argument is a
constant value and transform it at compile time to avoid runtime
overhead.
> But I think the call helps to make clear that the value is supposed to
> be in big endian.
It's more or less to satisfy static checkers. :)
> Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
--D
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-25 18:15 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25 17:41 [PATCH 1/2] xfs: fix uninitialized error variables Darrick J. Wong
2019-02-25 17:41 ` [PATCH 2/2] xfs: fix backwards endian conversion in scrub Darrick J. Wong
2019-02-25 18:09 ` Allison Henderson
2019-02-25 18:15 ` Darrick J. Wong
2019-02-25 17:53 ` [PATCH 1/2] xfs: fix uninitialized error variables Allison Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox