Bug 179427 - Gigacage.cpp:44:46: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
Summary: Gigacage.cpp:44:46: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-W...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: Other
Hardware: PC Linux
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-11-08 09:26 PST by Michael Catanzaro
Modified: 2017-11-15 09:41 PST (History)
5 users (show)

See Also:


Attachments
Patch (1.79 KB, patch)
2017-11-08 09:27 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (1.79 KB, patch)
2017-11-08 09:28 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff
Patch (1.40 KB, patch)
2017-11-08 10:57 PST, Michael Catanzaro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2017-11-08 09:26:33 PST
r224555 "We should PROT_NONE the Gigacage runway so OOB accesses crash" introduced this GCC warning:

[15/2288] Building CXX object Source/b...les/bmalloc.dir/bmalloc/Gigacage.cpp.o
../../Source/bmalloc/bmalloc/Gigacage.cpp: In lambda function:
../../Source/bmalloc/bmalloc/Gigacage.cpp:44:46: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
 #define GIGACAGE_RUNWAY (16llu * 1024 * 1024 * 1024)
                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
../../Source/bmalloc/bmalloc/Gigacage.cpp:159:17: note: in expansion of macro ‘GIGACAGE_RUNWAY’
             if (GIGACAGE_RUNWAY) {
                 ^~~~~~~~~~~~~~~
Comment 1 Michael Catanzaro 2017-11-08 09:27:59 PST
Created attachment 326332 [details]
Patch
Comment 2 Michael Catanzaro 2017-11-08 09:28:18 PST
Created attachment 326333 [details]
Patch
Comment 3 Saam Barati 2017-11-08 10:31:59 PST
Comment on attachment 326333 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=326333&action=review

> Source/bmalloc/bmalloc/Gigacage.cpp:159
> +#if !BCPU(ARM64)

Not a fan of this. Can we just make it
if (GIGACAGE_RUNWAY > 0)?
Comment 4 Saam Barati 2017-11-08 10:32:37 PST
(In reply to Saam Barati from comment #3)
> Comment on attachment 326333 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=326333&action=review
> 
> > Source/bmalloc/bmalloc/Gigacage.cpp:159
> > +#if !BCPU(ARM64)
> 
> Not a fan of this. Can we just make it
> if (GIGACAGE_RUNWAY > 0)?

To elaborate, this code shouldn't worry about which CPU it's on. If we decide to define GIGACAGE_RUNWAY for ARM64, we now need to change two lines of code instead of one.
Comment 5 Michael Catanzaro 2017-11-08 10:56:38 PST
(In reply to Saam Barati from comment #3) 
> Not a fan of this. Can we just make it
> if (GIGACAGE_RUNWAY > 0)?

D'oh, that's way better.
Comment 6 Michael Catanzaro 2017-11-08 10:57:02 PST
Created attachment 326339 [details]
Patch
Comment 7 WebKit Commit Bot 2017-11-08 11:30:39 PST
Comment on attachment 326339 [details]
Patch

Clearing flags on attachment: 326339

Committed r224588: <https://trac.webkit.org/changeset/224588>
Comment 8 WebKit Commit Bot 2017-11-08 11:30:41 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2017-11-15 09:41:42 PST
<rdar://problem/35562198>