Skip to content

Commit d74ec4d

Browse files
committed
Merge tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu into staging
trivial patches for 2024-07-17 # -----BEGIN PGP SIGNATURE----- # # iQEzBAABCAAdFiEEe3O61ovnosKJMUsicBtPaxppPlkFAmaXpakACgkQcBtPaxpp # Plnvvwf8DdybFjyhAVmiG6+6WhB5s0hJhZRiWzUY6ieMbgPzCUgWzfr/pJh6q44x # rw+aVfe2kf1ysycx3DjcJpucrC1rQD/qV6dB3IA1rxidBOZfCb8iZwoaB6yS9Epp # 4uXIdfje4zO6oCMN17MTXvuQIEUK3ZHN0EQOs7vsA2d8/pHqBqRoixjz9KnKHlpk # P6kyIXceZ4wLAtwFJqa/mBBRnpcSdaWuQpzpBsg1E3BXRXXfeuXJ8WmGp0kEOpzQ # k7+2sPpuah2z7D+jNFBW0+3ZYDvO9Z4pomQ4al4w+DHDyWBF49WnnSdDSDbWwxI5 # K0vUlsDVU8yTnIEgN8BL82F8eub5Ug== # =ZYHJ # -----END PGP SIGNATURE----- # gpg: Signature made Wed 17 Jul 2024 09:06:17 PM AEST # gpg: using RSA key 7B73BAD68BE7A2C289314B22701B4F6B1A693E59 # gpg: Good signature from "Michael Tokarev <mjt@tls.msk.ru>" [full] # gpg: aka "Michael Tokarev <mjt@debian.org>" [full] # gpg: aka "Michael Tokarev <mjt@corpit.ru>" [full] * tag 'pull-trivial-patches' of https://gitlab.com/mjt0k/qemu: meson: Update meson-buildoptions.sh backends/rng-random: Get rid of qemu_open_old() backends/iommufd: Get rid of qemu_open_old() backends/hostmem-epc: Get rid of qemu_open_old() hw/vfio/container: Get rid of qemu_open_old() hw/usb/u2f-passthru: Get rid of qemu_open_old() hw/usb/host-libusb: Get rid of qemu_open_old() hw/i386/sgx: Get rid of qemu_open_old() tests/avocado: Remove the non-working virtio_check_params test doc/net/l2tpv3: Update boolean fields' description to avoid short-form use target/hexagon/imported/mmvec: Fix superfluous trailing semicolon util/oslib-posix: Fix superfluous trailing semicolon hw/i386/x86: Fix superfluous trailing semicolon accel/kvm/kvm-all: Fix superfluous trailing semicolon README.rst: add the missing punctuations block/curl: rewrite http header parsing function Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 parents e648519 + 66a8de9 commit d74ec4d

File tree

16 files changed

+48
-208
lines changed

16 files changed

+48
-208
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ guidelines set out in the `style section
8282
the Developers Guide.
8383

8484
Additional information on submitting patches can be found online via
85-
the QEMU website
85+
the QEMU website:
8686

8787
* `<https://wiki.qemu.org/Contribute/SubmitAPatch>`_
8888
* `<https://wiki.qemu.org/Contribute/TrivialPatches>`_
@@ -102,7 +102,7 @@ requires a working 'git send-email' setup, and by default doesn't
102102
automate everything, so you may want to go through the above steps
103103
manually for once.
104104

105-
For installation instructions, please go to
105+
For installation instructions, please go to:
106106

107107
* `<https://github.com/stefanha/git-publish>`_
108108

@@ -159,7 +159,7 @@ Contact
159159
=======
160160

161161
The QEMU community can be contacted in a number of ways, with the two
162-
main methods being email and IRC
162+
main methods being email and IRC:
163163

164164
* `<mailto:qemu-devel@nongnu.org>`_
165165
* `<https://lists.nongnu.org/mailman/listinfo/qemu-devel>`_

accel/kvm/kvm-all.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3878,7 +3878,7 @@ static StatsList *add_kvmstat_entry(struct kvm_stats_desc *pdesc,
38783878
/* Alloc and populate data list */
38793879
stats = g_new0(Stats, 1);
38803880
stats->name = g_strdup(pdesc->name);
3881-
stats->value = g_new0(StatsValue, 1);;
3881+
stats->value = g_new0(StatsValue, 1);
38823882

38833883
if ((pdesc->flags & KVM_STATS_UNIT_MASK) == KVM_STATS_UNIT_BOOLEAN) {
38843884
stats->value->u.boolean = *stats_data;

backends/hostmem-epc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,8 @@ sgx_epc_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
2929
return false;
3030
}
3131

32-
fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
32+
fd = qemu_open("/dev/sgx_vepc", O_RDWR, errp);
3333
if (fd < 0) {
34-
error_setg_errno(errp, errno,
35-
"failed to open /dev/sgx_vepc to alloc SGX EPC");
3634
return false;
3735
}
3836

backends/iommufd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@ bool iommufd_backend_connect(IOMMUFDBackend *be, Error **errp)
7777
int fd;
7878

7979
if (be->owned && !be->users) {
80-
fd = qemu_open_old("/dev/iommu", O_RDWR);
80+
fd = qemu_open("/dev/iommu", O_RDWR, errp);
8181
if (fd < 0) {
82-
error_setg_errno(errp, errno, "/dev/iommu opening failed");
8382
return false;
8483
}
8584
be->fd = fd;

backends/rng-random.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ static void rng_random_opened(RngBackend *b, Error **errp)
7575
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
7676
"filename", "a valid filename");
7777
} else {
78-
s->fd = qemu_open_old(s->filename, O_RDONLY | O_NONBLOCK);
79-
if (s->fd == -1) {
80-
error_setg_file_open(errp, errno, s->filename);
81-
}
78+
s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK, errp);
8279
}
8380
}
8481

block/curl.c

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -210,37 +210,29 @@ static size_t curl_header_cb(void *ptr, size_t size, size_t nmemb, void *opaque)
210210
{
211211
BDRVCURLState *s = opaque;
212212
size_t realsize = size * nmemb;
213-
const char *header = (char *)ptr;
214-
const char *end = header + realsize;
215-
const char *accept_ranges = "accept-ranges:";
216-
const char *bytes = "bytes";
213+
const char *p = ptr;
214+
const char *end = p + realsize;
215+
const char *t = "accept-ranges : bytes "; /* A lowercase template */
217216

218-
if (realsize >= strlen(accept_ranges)
219-
&& g_ascii_strncasecmp(header, accept_ranges,
220-
strlen(accept_ranges)) == 0) {
221-
222-
char *p = strchr(header, ':') + 1;
223-
224-
/* Skip whitespace between the header name and value. */
225-
while (p < end && *p && g_ascii_isspace(*p)) {
226-
p++;
227-
}
228-
229-
if (end - p >= strlen(bytes)
230-
&& strncmp(p, bytes, strlen(bytes)) == 0) {
231-
232-
/* Check that there is nothing but whitespace after the value. */
233-
p += strlen(bytes);
234-
while (p < end && *p && g_ascii_isspace(*p)) {
235-
p++;
236-
}
237-
238-
if (p == end || !*p) {
239-
s->accept_range = true;
217+
/* check if header matches the "t" template */
218+
for (;;) {
219+
if (*t == ' ') { /* space in t matches any amount of isspace in p */
220+
if (p < end && g_ascii_isspace(*p)) {
221+
++p;
222+
} else {
223+
++t;
240224
}
225+
} else if (*t && p < end && *t == g_ascii_tolower(*p)) {
226+
++p, ++t;
227+
} else {
228+
break;
241229
}
242230
}
243231

232+
if (!*t && p == end) { /* if we managed to reach ends of both strings */
233+
s->accept_range = true;
234+
}
235+
244236
return realsize;
245237
}
246238

hw/i386/sgx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,12 @@ SGXInfo *qmp_query_sgx_capabilities(Error **errp)
157157
{
158158
SGXInfo *info = NULL;
159159
uint32_t eax, ebx, ecx, edx;
160+
Error *local_err = NULL;
160161

161-
int fd = qemu_open_old("/dev/sgx_vepc", O_RDWR);
162+
int fd = qemu_open("/dev/sgx_vepc", O_RDWR, &local_err);
162163
if (fd < 0) {
163-
error_setg(errp, "SGX is not enabled in KVM");
164+
error_append_hint(&local_err, "SGX is not enabled in KVM");
165+
error_propagate(errp, local_err);
164166
return NULL;
165167
}
166168

hw/i386/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static void x86_machine_get_pit(Object *obj, Visitor *v, const char *name,
242242
static void x86_machine_set_pit(Object *obj, Visitor *v, const char *name,
243243
void *opaque, Error **errp)
244244
{
245-
X86MachineState *x86ms = X86_MACHINE(obj);;
245+
X86MachineState *x86ms = X86_MACHINE(obj);
246246

247247
visit_type_OnOffAuto(v, name, &x86ms->pit, errp);
248248
}

hw/usb/host-libusb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,9 +1212,8 @@ static void usb_host_realize(USBDevice *udev, Error **errp)
12121212
if (s->hostdevice) {
12131213
int fd;
12141214
s->needs_autoscan = false;
1215-
fd = qemu_open_old(s->hostdevice, O_RDWR);
1215+
fd = qemu_open(s->hostdevice, O_RDWR, errp);
12161216
if (fd < 0) {
1217-
error_setg_errno(errp, errno, "failed to open %s", s->hostdevice);
12181217
return;
12191218
}
12201219
rc = usb_host_open(s, NULL, fd);

hw/usb/u2f-passthru.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,10 +482,8 @@ static void u2f_passthru_realize(U2FKeyState *base, Error **errp)
482482
return;
483483
#endif
484484
} else {
485-
fd = qemu_open_old(key->hidraw, O_RDWR);
485+
fd = qemu_open(key->hidraw, O_RDWR, errp);
486486
if (fd < 0) {
487-
error_setg(errp, "%s: Failed to open %s", TYPE_U2F_PASSTHRU,
488-
key->hidraw);
489487
return;
490488
}
491489

0 commit comments

Comments
 (0)