On 03/18/2015 11:22 PM, Steve Beattie wrote:
> Hello,
> 
> The fix to prevent the compiler from SEGV'ing when dumping network
> rules in commit 2888 introduced the following compiler warning:
> 
>   network.c: In function ‘const char* net_find_af_name(unsigned int)’:
>   network.c:331:16: warning: comparison between signed and unsigned integer 
> expressions [-Wsign-compare]
>     for (i = 0; i < sizeof(network_mappings) / sizeof(*network_mappings); 
> i++) {
> 
> The problem is that the counter i is an int, but sizeof returns size_t
> which is unsigned. The following patch fixes the issue by converting the
> type of i to size_t.
> 
> Signed-off-by: Steve Beattie <[email protected]> for trunk and 2.9.
Acked-by: John Johansen <[email protected]>

> ---
>  parser/network.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: b/parser/network.c
> ===================================================================
> --- a/parser/network.c
> +++ b/parser/network.c
> @@ -323,7 +323,7 @@ struct aa_network_entry *network_entry(c
>  
>  const char *net_find_af_name(unsigned int af)
>  {
> -     int i;
> +     size_t i;
>  
>       if (af < 0 || af > get_af_max())
>               return NULL;
> 
> 
> 


-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to