From nobody Fri Nov 14 22:21:22 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1760019116; cv=none; d=zohomail.com; s=zohoarc; b=OQI+s23MtsoMFgfP+G3auN/ZNMF8dk0GxeVkrPTrGnTyoI3suMTTxqZczK3UOhfxF7PYtUcBiCmtemmaCkZPOmsFHvz3Y3a4y7vdDcjjEcom0983hK91tDyO97r2GQ7J8lIRgx5QY0npRvtLhu7iC99aWDaFAwdWv2sJ40FGP9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760019116; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=T62vm6+niHDYeOVCra1Ql5diIM7fJTI1DNT0MGSdcWk=; b=J+Z61xviyctFvpihjxlwcXrOkQhNqa7X8cYrXrpGqVV6malTA89GLHIS/2U4UjwEVL+/+xQxKxfwxr6tv8t8H/dHnpYzEXqX9LTmv86RwIdRfE2yR7ZXbsE61pv6sVqb0wL7LB54xSa35KB6G/WZuDfgeYRriZ9YHY2qDGVd3js= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1760019116406794.0530156968335; Thu, 9 Oct 2025 07:11:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1v6rM9-0006sA-J4; Thu, 09 Oct 2025 10:10:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v6rM8-0006rp-8U for qemu-devel@nongnu.org; Thu, 09 Oct 2025 10:10:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1v6rLw-0008Pd-SM for qemu-devel@nongnu.org; Thu, 09 Oct 2025 10:10:55 -0400 Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-88-PljcQ9QFMd6Rdmr4g9qr5w-1; Thu, 09 Oct 2025 10:10:40 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 57EED1800288; Thu, 9 Oct 2025 14:10:38 +0000 (UTC) Received: from cash.home.annexia.org (unknown [10.45.224.22]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id D90341955F22; Thu, 9 Oct 2025 14:10:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760019043; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T62vm6+niHDYeOVCra1Ql5diIM7fJTI1DNT0MGSdcWk=; b=BGg3HtIajynCxlj7JUQaDFL2sEA9c2cxocIlepkbsvZZx3J2aMKIDez1RawE7ddUNN8956 4RW+1KT0wUWiAgHyWn9X1gCBNx9tZ1PeIRgpitvHYSvnNn1COjV3CfakU7xUS7ysQI0bU0 wGcaDrpoqhyu1rPBgu132hXLZgGlNq0= X-MC-Unique: PljcQ9QFMd6Rdmr4g9qr5w-1 X-Mimecast-MFC-AGG-ID: PljcQ9QFMd6Rdmr4g9qr5w_1760019039 From: "Richard W.M. Jones" To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, odaki@rsg.ci.i.u-tokyo.ac.jp, viktor.prutyanov@phystech.edu, hreitz@redhat.com, kwolf@redhat.com, maochenxi@bosc.ac.cn, berrange@redhat.com, peter.maydell@linaro.org Subject: [PATCH v2] block/curl.c: Use explicit long constants in curl_easy_setopt calls Date: Thu, 9 Oct 2025 15:08:31 +0100 Message-ID: <20251009141026.4042021-2-rjones@redhat.com> In-Reply-To: <20251009141026.4042021-1-rjones@redhat.com> References: <20251009141026.4042021-1-rjones@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=rjones@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.438, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1760019139558116600 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 =E2=80=98curl_init_state=E2=80=99: ../block/curl.c:474:13: warning: call to =E2=80=98_curl_easy_setopt_err_lon= g=E2=80=99 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 Signed-off-by: Chenxi Mao Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Akihiko Odaki Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- 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, CURLStat= e *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->errm= sg) || - 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 *optio= ns, int flags, } =20 s->accept_range =3D 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) !=3D CURLE_OK || curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL) !=3D CU= RLE_OK || curl_easy_setopt(curl, CURLOPT_WRITEDATA, file) !=3D CURLE_= OK - || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1) !=3D CURL= E_OK - || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0) !=3D CURLE_OK + || curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L) !=3D CUR= LE_OK + || curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L) !=3D CURLE_OK || curl_easy_perform(curl) !=3D CURLE_OK) { unlink(name); fclose(file); --=20 2.50.1