All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Schmidt <stefan@datenfreihafen.org>
To: linux-wpan@vger.kernel.org
Cc: aring@mojatatu.com
Subject: Re: [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value
Date: Wed, 19 Dec 2018 14:33:11 +0100	[thread overview]
Message-ID: <8f140636-2b12-4c1f-6d56-4fe65659dde9@datenfreihafen.org> (raw)
In-Reply-To: <20181206202602.22176-1-stefan@datenfreihafen.org>

Hello.

On 06.12.18 21:26, Stefan Schmidt wrote:
> Our CI found this when building with clang (seems to have
> the option on by deafult)
> 
> iwpan.c:469:13: warning: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Wabsolute-value]
>         cmd_size = abs((long)&__section_set - (long)&__section_get);
>                    ^
> iwpan.c:469:13: note: use function 'labs' instead
>         cmd_size = abs((long)&__section_set - (long)&__section_get);
>                    ^~~
>                    labs
> 
> This also follows a change in iw, where we derived from.
> 
> Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
> ---
>  src/iwpan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/iwpan.c b/src/iwpan.c
> index e7781fd..fb7bef1 100644
> --- a/src/iwpan.c
> +++ b/src/iwpan.c
> @@ -466,7 +466,7 @@ int main(int argc, char **argv)
>  	int err;
>  
>  	/* calculate command size including padding */
> -	cmd_size = abs((long)&__section_set - (long)&__section_get);
> +	cmd_size = labs((long)&__section_set - (long)&__section_get);
>  	/* strip off self */
>  	argc--;
>  	argv0 = *argv++;
> 

This patch has now been applied to wpan-tools.

regards
Stefan Schmidt

      parent reply	other threads:[~2018-12-19 13:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-06 20:26 [PATCH 1/2] iwpan: fix clang compiler warning on absolute-value Stefan Schmidt
2018-12-06 20:26 ` [PATCH 2/2] examples: fix wrongly used unsigned attribute Stefan Schmidt
2018-12-19 13:33   ` Stefan Schmidt
2018-12-19 13:33 ` Stefan Schmidt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8f140636-2b12-4c1f-6d56-4fe65659dde9@datenfreihafen.org \
    --to=stefan@datenfreihafen.org \
    --cc=aring@mojatatu.com \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.