* [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls @ 2025-10-09 14:08 Richard W.M. Jones 2025-10-09 14:08 ` Richard W.M. Jones 0 siblings, 1 reply; 8+ messages in thread From: Richard W.M. Jones @ 2025-10-09 14:08 UTC (permalink / raw) To: qemu-devel Cc: qemu-block, odaki, viktor.prutyanov, hreitz, kwolf, maochenxi, berrange, peter.maydell v1 was posted here: https://patchwork.ozlabs.org/project/qemu-devel/patch/20251001124055.2743244-1-rjones@redhat.com/ In v2, I incorporated additional changes found by Chenxi Mao. Rich. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls Richard W.M. Jones @ 2025-10-09 14:08 ` Richard W.M. Jones 2025-10-09 15:38 ` Richard Henderson ` (4 more replies) 0 siblings, 5 replies; 8+ messages in thread From: Richard W.M. Jones @ 2025-10-09 14:08 UTC (permalink / raw) To: qemu-devel Cc: qemu-block, odaki, viktor.prutyanov, hreitz, kwolf, maochenxi, berrange, peter.maydell curl_easy_setopt takes a variable argument that depends on what CURLOPT you are setting. Some require a long constant. Passing a plain int constant is potentially wrong on some platforms. With warnings enabled, multiple warnings like this were printed: ../block/curl.c: In function ‘curl_init_state’: ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || | ^ Signed-off-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> --- block/curl.c | 10 +++++----- contrib/elf2dmp/download.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/curl.c b/block/curl.c index e0f98e035a..68cf83ce55 100644 --- a/block/curl.c +++ b/block/curl.c @@ -471,11 +471,11 @@ static int curl_init_state(BDRVCURLState *s, CURLState *state) (void *)curl_read_cb) || curl_easy_setopt(state->curl, CURLOPT_WRITEDATA, (void *)state) || curl_easy_setopt(state->curl, CURLOPT_PRIVATE, (void *)state) || - curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || - curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1) || - curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1) || + curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1L) || + curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1L) || + curl_easy_setopt(state->curl, CURLOPT_NOSIGNAL, 1L) || curl_easy_setopt(state->curl, CURLOPT_ERRORBUFFER, state->errmsg) || - curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1)) { + curl_easy_setopt(state->curl, CURLOPT_FAILONERROR, 1L)) { goto err; } if (s->username) { @@ -800,7 +800,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags, } s->accept_range = false; - if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1) || + if (curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1L) || curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb) || curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s)) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, diff --git a/contrib/elf2dmp/download.c b/contrib/elf2dmp/download.c index 21306b3fd4..fa8da0f9a2 100644 --- a/contrib/elf2dmp/download.c +++ b/contrib/elf2dmp/download.c @@ -27,8 +27,8 @@ bool download_url(const char *name, const char *url) if (curl_easy_setopt(curl, CURLOPT_URL, url) != CURLE_OK || curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) != CURLE_OK || curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) != CURLE_OK - || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) != CURLE_OK - || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) != CURLE_OK + || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) != CURLE_OK + || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) != CURLE_OK || curl_easy_perform(curl) != CURLE_OK) { unlink(name); fclose(file); -- 2.50.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 ` Richard W.M. Jones @ 2025-10-09 15:38 ` Richard Henderson 2025-10-10 3:39 ` Akihiko Odaki ` (3 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Richard Henderson @ 2025-10-09 15:38 UTC (permalink / raw) To: qemu-devel On 10/9/25 07:08, Richard W.M. Jones wrote: > curl_easy_setopt takes a variable argument that depends on what > CURLOPT you are setting. Some require a long constant. Passing a > plain int constant is potentially wrong on some platforms. > > With warnings enabled, multiple warnings like this were printed: > > ../block/curl.c: In function ‘curl_init_state’: > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > | ^ > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > --- > block/curl.c | 10 +++++----- > contrib/elf2dmp/download.c | 4 ++-- > 2 files changed, 7 insertions(+), 7 deletions(-) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 ` Richard W.M. Jones 2025-10-09 15:38 ` Richard Henderson @ 2025-10-10 3:39 ` Akihiko Odaki 2025-10-10 6:30 ` Thomas Huth ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Akihiko Odaki @ 2025-10-10 3:39 UTC (permalink / raw) To: Richard W.M. Jones, qemu-devel Cc: qemu-block, viktor.prutyanov, hreitz, kwolf, maochenxi, berrange, peter.maydell On 2025/10/09 23:08, Richard W.M. Jones wrote: > curl_easy_setopt takes a variable argument that depends on what > CURLOPT you are setting. Some require a long constant. Passing a > plain int constant is potentially wrong on some platforms. > > With warnings enabled, multiple warnings like this were printed: > > ../block/curl.c: In function ‘curl_init_state’: > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > | ^ > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 ` Richard W.M. Jones 2025-10-09 15:38 ` Richard Henderson 2025-10-10 3:39 ` Akihiko Odaki @ 2025-10-10 6:30 ` Thomas Huth 2025-10-10 19:03 ` Richard Henderson 2025-10-13 12:23 ` Kevin Wolf 4 siblings, 0 replies; 8+ messages in thread From: Thomas Huth @ 2025-10-10 6:30 UTC (permalink / raw) To: Richard W.M. Jones, qemu-devel Cc: qemu-block, odaki, viktor.prutyanov, hreitz, kwolf, maochenxi, berrange, peter.maydell, Richard Henderson On 09/10/2025 16.08, Richard W.M. Jones wrote: > curl_easy_setopt takes a variable argument that depends on what > CURLOPT you are setting. Some require a long constant. Passing a > plain int constant is potentially wrong on some platforms. > > With warnings enabled, multiple warnings like this were printed: > > ../block/curl.c: In function ‘curl_init_state’: > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > | ^ > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > --- > block/curl.c | 10 +++++----- > contrib/elf2dmp/download.c | 4 ++-- > 2 files changed, 7 insertions(+), 7 deletions(-) Thanks, this seems to fix the broken freebsd job in our gitlab CI! Reviewed-by: Thomas Huth <thuth@redhat.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 ` Richard W.M. Jones ` (2 preceding siblings ...) 2025-10-10 6:30 ` Thomas Huth @ 2025-10-10 19:03 ` Richard Henderson 2025-10-13 12:16 ` Kevin Wolf 2025-10-13 12:23 ` Kevin Wolf 4 siblings, 1 reply; 8+ messages in thread From: Richard Henderson @ 2025-10-10 19:03 UTC (permalink / raw) To: qemu-devel On 10/9/25 07:08, Richard W.M. Jones wrote: > curl_easy_setopt takes a variable argument that depends on what > CURLOPT you are setting. Some require a long constant. Passing a > plain int constant is potentially wrong on some platforms. > > With warnings enabled, multiple warnings like this were printed: > > ../block/curl.c: In function ‘curl_init_state’: > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > | ^ > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > --- > block/curl.c | 10 +++++----- > contrib/elf2dmp/download.c | 4 ++-- > 2 files changed, 7 insertions(+), 7 deletions(-) Thanks. I directly applied this to master during the last PR batch. r~ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-10 19:03 ` Richard Henderson @ 2025-10-13 12:16 ` Kevin Wolf 0 siblings, 0 replies; 8+ messages in thread From: Kevin Wolf @ 2025-10-13 12:16 UTC (permalink / raw) To: Richard Henderson Cc: qemu-devel, qemu-block, odaki, viktor.prutyanov, hreitz, kwolf, maochenxi, berrange, peter.maydell [Restored the original Cc: list] Am 10.10.2025 um 21:03 hat Richard Henderson geschrieben: > On 10/9/25 07:08, Richard W.M. Jones wrote: > > curl_easy_setopt takes a variable argument that depends on what > > CURLOPT you are setting. Some require a long constant. Passing a > > plain int constant is potentially wrong on some platforms. > > > > With warnings enabled, multiple warnings like this were printed: > > > > ../block/curl.c: In function ‘curl_init_state’: > > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > > | ^ It would have been good to mention on which platforms/compilers/curl versions you get the warning (and why only now), because I don't see this warning even after reverting the commit. It's too late for the commit message now, but maybe we can at least have it here, in the mailing list thread associated with the Message-ID in the commit? > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> > > --- > > block/curl.c | 10 +++++----- > > contrib/elf2dmp/download.c | 4 ++-- > > 2 files changed, 7 insertions(+), 7 deletions(-) > > Thanks. I directly applied this to master during the last PR batch. Please don't drop CCs in replies. This is true in general, but even more so if it's CCs for the maintainers you're bypassing. Kevin ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls 2025-10-09 14:08 ` Richard W.M. Jones ` (3 preceding siblings ...) 2025-10-10 19:03 ` Richard Henderson @ 2025-10-13 12:23 ` Kevin Wolf 4 siblings, 0 replies; 8+ messages in thread From: Kevin Wolf @ 2025-10-13 12:23 UTC (permalink / raw) To: Richard W.M. Jones Cc: qemu-devel, qemu-block, odaki, viktor.prutyanov, hreitz, maochenxi, berrange, peter.maydell Am 09.10.2025 um 16:08 hat Richard W.M. Jones geschrieben: > curl_easy_setopt takes a variable argument that depends on what > CURLOPT you are setting. Some require a long constant. Passing a > plain int constant is potentially wrong on some platforms. > > With warnings enabled, multiple warnings like this were printed: > > ../block/curl.c: In function ‘curl_init_state’: > ../block/curl.c:474:13: warning: call to ‘_curl_easy_setopt_err_long’ declared with attribute warning: curl_easy_setopt expects a long argument [-Wattribute-warning] > 474 | curl_easy_setopt(state->curl, CURLOPT_AUTOREFERER, 1) || > | ^ > > Signed-off-by: Richard W.M. Jones <rjones@redhat.com> > Signed-off-by: Chenxi Mao <maochenxi@bosc.ac.cn> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> CURLOPT_VERBOSE takes a long, too. It's hidden behind an #ifdef DEBUG_VERBOSE, so we won't see it in normal builds, but would be nice to fix it, too. Kevin ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-10-13 12:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-09 14:08 [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls Richard W.M. Jones 2025-10-09 14:08 ` Richard W.M. Jones 2025-10-09 15:38 ` Richard Henderson 2025-10-10 3:39 ` Akihiko Odaki 2025-10-10 6:30 ` Thomas Huth 2025-10-10 19:03 ` Richard Henderson 2025-10-13 12:16 ` Kevin Wolf 2025-10-13 12:23 ` Kevin Wolf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).