x86/mm: Placate DEADCODE Coverity warning
PATCH 1/1 x86/mm: Placate DEADCODE Coverity warning
_PAGE_GNTTAB is only used in debug builds of Xen; in release builds, it has the value 0. Coverity complains that "l1e_get_flags(l1e) & 0" is logically dead.
Add an extra condition into the logic to skip the flag check if _PAGE_GNTTAB is 0.
No functional change.
Coverity-ID: 1362036
---
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/arch/x86/mm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/mm.c +1 -1
@@ -1252,7 +1252,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domain *l1e_owner)* (Note that the undestroyable active grants are not a security hole in * Xen. All active grants can safely be cleaned up when the domain dies.) */ -if ( (l1e_get_flags (l1e) & _PAGE_GNTTAB) && +if ( _PAGE_GNTTAB && (l1e_get_flags (l1e) & _PAGE_GNTTAB) && !l1e_owner->is_shutting_down && !l1e_owner->is_dying ) { gdprintk(XENLOG_WARNING,
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTABis 0.
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
Quoted 4 lines
No functional change.
Coverity-ID: 1362036
Signed-off-by Andrew Cooper <[email protected]>
So provided the change really silences Coverity:
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi,
Quoted 11 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTABis 0.And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Quoted 8 lines
Quoted 5 lines
No functional change.
Coverity-ID: 1362036
Signed-off-by Andrew Cooper <[email protected]>So provided the change really silences Coverity:
Acked-by Jan Beulich <[email protected]>
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.
Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
~Andrew
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
No functional change.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Coverity-ID: 1362036
Signed-off-by Andrew Cooper <[email protected]>So provided the change really silences Coverity:
Acked-by Jan Beulich <[email protected]>Cheers,
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Andrew,
Quoted 24 lines · Andrew Cooper
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
Quoted 8 lines
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
Are we running staging-4.* branch on Coverity? Looking at the git, I see *coverity* branch only on unstable.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 33 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:09, <[email protected]> wrote:
Hi Andrew,
Quoted 29 lines · Andrew Cooper
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Quoted 6 lines
Quoted 3 lines
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
Are we running staging-4.* branch on Coverity? Looking at the git, I see *coverity* branch only on unstable.
Yes, so my suggestion would be to commit the patch on master, see if it helps, and if so consider backporting for 4.9. If it doesn't help, it should be reverted or replaced by something "better".
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Hi Jan,
Quoted 37 lines · Jan Beulich
Quoted 37 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:09, <[email protected]> wrote:
Hi Andrew,
Quoted 32 lines · Andrew Cooper
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
Quoted 6 lines
Quoted 2 lines
Are we running staging-4.* branch on Coverity? Looking at the git, I see *coverity* branch only on unstable.
Yes, so my suggestion would be to commit the patch on master, see if it helps, and if so consider backporting for 4.9. If it doesn't help, it should be reverted or replaced by something "better".
Well master has now debug enabled and AFAIU the warning can only occurred on non-debug build. So I am not sure how this would help to be in master.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:18, <[email protected]> wrote:
Hi Jan,
Quoted 40 lines · Jan Beulich
Quoted 39 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:09, <[email protected]> wrote:
Hi Andrew,
Quoted 24 lines · Andrew Cooper
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
Quoted 8 lines
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
Are we running staging-4.* branch on Coverity? Looking at the git, I see *coverity* branch only on unstable.
Quoted 7 lines
Quoted 3 lines
Yes, so my suggestion would be to commit the patch on master, see if it helps, and if so consider backporting for 4.9. If it doesn't help, it should be reverted or replaced by something "better".
Well master has now debug enabled and AFAIU the warning can only occurred on non-debug build. So I am not sure how this would help to be in master.
Oh, good point. I think it would really be a good idea to have both debug and non-debug builds tested, which at once would avoid sudden bursts of issues when switching the default.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
CC Ian + Wei for the testing
Quoted 58 lines · Jan Beulich
Quoted 44 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:18, <[email protected]> wrote:
Hi Jan,
Quoted 40 lines · Jan Beulich
Quoted 39 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:09, <[email protected]> wrote:
Hi Andrew,
Quoted 24 lines · Andrew Cooper
Quoted 14 lines · Julien Grall
Hi,
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds, it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 6 lines
Quoted 3 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look logically the same (i.e. I'd expect the same warnings to be triggered [or not]).
I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
Quoted 8 lines
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while the other looks like a programming mistake, which is also why I expect this to resolve Coverity's complaint.
Unfortunately, I can't be certain that this will resolve the issue until it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.
Are we running staging-4.* branch on Coverity? Looking at the git, I see *coverity* branch only on unstable.
Quoted 7 lines
Quoted 3 lines
Yes, so my suggestion would be to commit the patch on master, see if it helps, and if so consider backporting for 4.9. If it doesn't help, it should be reverted or replaced by something "better".
Well master has now debug enabled and AFAIU the warning can only occurred on non-debug build. So I am not sure how this would help to be in master.
Oh, good point. I think it would really be a good idea to have both debug and non-debug builds tested, which at once would avoid sudden bursts of issues when switching the default.
Jan
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 66 lines · Julien Grall
CC Ian + Wei for the testing
Quoted 63 lines · Jan Beulich
Quoted 51 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:18, <[email protected]> wrote:
Hi Jan,
Quoted 47 lines · Jan Beulich
Quoted 46 lines
Quoted 1 line
Quoted 1 line · On 01.06.17 at 13:09, <[email protected]> wrote:
Hi Andrew,
Quoted 34 lines · Andrew Cooper
Quoted 15 lines · Julien Grall
Hi,
Quoted 12 lines · Jan Beulich
Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 22.05.17 at 15:12, <[email protected]> wrote:
_PAGE_GNTTABis only used in debug builds of Xen; in release builds,
it has
the value 0. Coverity complains that "l1e_get_flags(l1e)& 0" is logically
dead.Add an extra condition into the logic to skip the flag check if
_PAGE_GNTTAB
is 0.Quoted 8 lines
Quoted 5 lines
And this helps? To me "if ( 0 && ... )" and "if ( (x & 0) && ... )" look
logically the same (i.e. I'd expect the same warnings to be triggered
[or not]).I haven't seen any answer on this question. Andrew, does this patch still hold for Xen 4.9?
Sorry - it fell through the cracks, but yes, it does stand for 4.9.
As to the "if ( 0 && ... )" and "if ( (x & 0) && ... )", one is very clearly a "short circuit every thing else if this value is zero", while
the other looks like a programming mistake, which is also why I expect
this to resolve Coverity's complaint.Quoted 4 lines
Unfortunately, I can't be certain that this will resolve the issue until
it gets committed, as I don't have a useful way to run Coverity on arbitrary non-debug builds.Are we running staging-4.* branch on Coverity? Looking at the git, I see
*coverity* branch only on unstable.Quoted 8 lines
Quoted 4 lines
Yes, so my suggestion would be to commit the patch on master, see if it helps, and if so consider backporting for 4.9. If it doesn't help,
it should be reverted or replaced by something "better".Well master has now debug enabled and AFAIU the warning can only occurred on non-debug build. So I am not sure how this would help to be in master.
Oh, good point. I think it would really be a good idea to have both debug and non-debug builds tested, which at once would avoid sudden bursts of issues when switching the default.
We cannot test both at the same time.
The free Coverity Scan only offers a single stream, which means we can only submit a single logical stream of successive changes.
Ideally, this patch would have gotten in to staging while coverity was still running the release build, so we would have gotten a positive answer on the next scan.
Without taking this patch (assuming it fixes the issue), we will have the same issue flap in our results every time we do a release.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel