[v2] vfio: fix stdbool usage without include

Message ID 20210601082825.1604489-1-christian.ehrhardt@canonical.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v2] vfio: fix stdbool usage without include |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot success github build: passed
ci/iol-abi-testing success Testing PASS
ci/Intel-compilation fail Compilation issues
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Christian Ehrhardt June 1, 2021, 8:28 a.m. UTC
  This became visible by backporting the following for the 19.11 stable tree:
 c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"

The usage of type bool in the vfio code would require "#include
<stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
It happens that in eal_vfio_mp_sync.c it comes after "#include
<rte_log.h>".

And rte_log.h since 20.05 includes stdbool since this change:
 241e67bfe "log: add API to check if a logtype can log in a given level"
and thereby mitigates the issue.

It should be safe to include stdbool.h from rte_vfio.h itself
to be present exactly when needed for the struct it defines using that
type.

Fixes: c13ca4e81cac ("vfio: fix DMA mapping granularity for IOVA as VA")

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 lib/eal/include/rte_vfio.h | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Burakov, Anatoly June 2, 2021, 11:06 a.m. UTC | #1
On 01-Jun-21 9:28 AM, Christian Ehrhardt wrote:
> This became visible by backporting the following for the 19.11 stable tree:
>   c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"
> 
> The usage of type bool in the vfio code would require "#include
> <stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
> It happens that in eal_vfio_mp_sync.c it comes after "#include
> <rte_log.h>".
> 
> And rte_log.h since 20.05 includes stdbool since this change:
>   241e67bfe "log: add API to check if a logtype can log in a given level"
> and thereby mitigates the issue.
> 
> It should be safe to include stdbool.h from rte_vfio.h itself
> to be present exactly when needed for the struct it defines using that
> type.
> 
> Fixes: c13ca4e81cac ("vfio: fix DMA mapping granularity for IOVA as VA")
> 
> Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>   lib/eal/include/rte_vfio.h | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
> index e7a87454bea..2d90b364801 100644
> --- a/lib/eal/include/rte_vfio.h
> +++ b/lib/eal/include/rte_vfio.h
> @@ -14,6 +14,7 @@
>   extern "C" {
>   #endif
>   
> +#include <stdbool.h>
>   #include <stdint.h>
>   
>   /*
> 
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
  
Thomas Monjalon June 17, 2021, 3:41 p.m. UTC | #2
02/06/2021 13:06, Burakov, Anatoly:
> On 01-Jun-21 9:28 AM, Christian Ehrhardt wrote:
> > This became visible by backporting the following for the 19.11 stable tree:
> >   c13ca4e8 "vfio: fix DMA mapping granularity for IOVA as VA"
> > 
> > The usage of type bool in the vfio code would require "#include
> > <stdbool.h>", but rte_vfio.h has no direct paths to stdbool.h.
> > It happens that in eal_vfio_mp_sync.c it comes after "#include
> > <rte_log.h>".
> > 
> > And rte_log.h since 20.05 includes stdbool since this change:
> >   241e67bfe "log: add API to check if a logtype can log in a given level"
> > and thereby mitigates the issue.
> > 
> > It should be safe to include stdbool.h from rte_vfio.h itself
> > to be present exactly when needed for the struct it defines using that
> > type.
> > 
> > Fixes: c13ca4e81cac ("vfio: fix DMA mapping granularity for IOVA as VA")
> > 
> > Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > 
> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

Applied, thanks.
  

Patch

diff --git a/lib/eal/include/rte_vfio.h b/lib/eal/include/rte_vfio.h
index e7a87454bea..2d90b364801 100644
--- a/lib/eal/include/rte_vfio.h
+++ b/lib/eal/include/rte_vfio.h
@@ -14,6 +14,7 @@ 
 extern "C" {
 #endif
 
+#include <stdbool.h>
 #include <stdint.h>
 
 /*