From patchwork Tue Jun 6 14:37:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 13269324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 511B3C7EE24 for ; Tue, 6 Jun 2023 14:50:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238191AbjFFOuZ (ORCPT ); Tue, 6 Jun 2023 10:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237856AbjFFOtn (ORCPT ); Tue, 6 Jun 2023 10:49:43 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 836031712 for ; Tue, 6 Jun 2023 07:48:49 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-30aeee7c8a0so4508365f8f.1 for ; Tue, 06 Jun 2023 07:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aSOjU/peLBkZFAWfQ1yaQPRur2Vz8IL+LTbwDYZRyv4=; b=oi3fFDF5AYQ3Qbn4ovBhoFRM/iaiHlWG5LkCAFue091YkR2wPknZjq6SNIq/bRqWwQ uxM82ldwbfG88QsCRX1JMMsYcBwmiDeYnUSc6I37ALF4ckOaSH5glpjwwGcICv0MZYhV Erxj2eL8gKrGLBPszi2abOe36VvQmxuoBUAhHoUsFltrBimX3CSmz8gX9ouvurIkRFqb DuT9zPLCVm4gI5jAdu5o81EC2E2BNKAYul9nQEIka8+iwFBODCIf8puLIHfQkFhtey3z B1KC9s/1ltTbb8ipTWuKgp69xF/ccf7KuMVghaHgxSQPdwxqGVzhCmGtCeK8951kpIRi fEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aSOjU/peLBkZFAWfQ1yaQPRur2Vz8IL+LTbwDYZRyv4=; b=N2SK2uU7rKDLYPXUCC58FLBhxTNhmw0EkyYANurIE8c6Q6xBkV8xrc7QUjA/CsnfM/ BLeBR/sYLVohDTIlP6DgMt+xkqQG1L2p/5zM/ngb1ywvAcUrNohnWWI5HlZYfynm587s uQW2lnqrwwbP3aqMdCH3w31uHLLZFdehvlKLGzDxCueUGlM7uFDsFWsT7/hmAoMEdxop C3wzYiPaF4Im+w393PNjH/YX184T7KW8ZnCM7IOcO9bg8dQ7ksq3l7aV7Z+iQSAG5KBo iI75YbRDGwSi7C1mskceQQUDWXQCDIIq2q67nBKNzz1RUyyx0jkwy6KCyf2TQ96fPhzj /Uaw== X-Gm-Message-State: AC+VfDxO2Q4zOmh/JCEOfxv3NX93GYBL6SKX2MyCm1wf8d8mALJgd48o NlBNIEIbxCKkcXxeh4fnr3hoyBL1vplXxI0As2BXKQ== X-Google-Smtp-Source: ACHHUZ6VjSEJGxNDtpYJTns8vjQUNPaYPEapkvMG2LCJZW4VOAQ5GL5myVffYJO4ITAUOWTfDTSeTQ== X-Received: by 2002:a5d:5581:0:b0:309:48eb:993d with SMTP id i1-20020a5d5581000000b0030948eb993dmr8923125wrv.15.1686062927841; Tue, 06 Jun 2023 07:48:47 -0700 (PDT) Received: from localhost.localdomain (5750a5b3.skybroadband.com. [87.80.165.179]) by smtp.gmail.com with ESMTPSA id o9-20020a05600c378900b003f7e4d143cfsm5722692wmr.15.2023.06.06.07.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 07:48:47 -0700 (PDT) From: Jean-Philippe Brucker To: kvm@vger.kernel.org, will@kernel.org Cc: Jean-Philippe Brucker Subject: [PATCH kvmtool 1/3] Makefile: Refine -s handling in the make parameters Date: Tue, 6 Jun 2023 15:37:34 +0100 Message-Id: <20230606143733.994679-2-jean-philippe@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606143733.994679-1-jean-philippe@linaro.org> References: <20230606143733.994679-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org When looking for the silent flag 's' in MAKEFLAGS we accidentally catch variable definitions like "ARCH=mips" or "CROSS_COMPILE=/cross/...", causing several test builds to be silent. MAKEFLAGS contains the single-letter make flags (without the dash), followed by flags that don't have a single-letter equivalent such as "--warn-undefined-variables" (with the dashes), followed by "--" and command-line variables. For example `make ARCH=mips -k' results in MAKEFLAGS "k -- ARCH=mips". Running $(filter-out --%) on this does not discard ARCH=mips, only "--". However adding $(firstword) ensures that we run the filter either on the single-letter flags or on something beginning with "--", and avoids silent builds. Signed-off-by: Jean-Philippe Brucker --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6b742369..e711670d 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # ifeq ($(strip $(V)),) - ifeq ($(findstring s,$(filter-out --%,$(MAKEFLAGS))),) + ifeq ($(findstring s,$(filter-out --%,$(firstword $(MAKEFLAGS)))),) E = @echo else E = @\# From patchwork Tue Jun 6 14:37:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 13269323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D320EC7EE24 for ; Tue, 6 Jun 2023 14:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237257AbjFFOuX (ORCPT ); Tue, 6 Jun 2023 10:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238413AbjFFOtn (ORCPT ); Tue, 6 Jun 2023 10:49:43 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B64BD1BEF for ; Tue, 6 Jun 2023 07:48:49 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-3f736e0c9a8so24129255e9.2 for ; Tue, 06 Jun 2023 07:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9SvND4Aoifwo+dUZ1S4WsTaPbsjIsvOLxsML72gE5gQ=; b=W0OzQujYiFTvXg55rGZ10eI+6awilNw7pRMlA0O/YJNbn/9Kbj31LK4kKBhsb3FAjO 21MI1dhKvKXonr9cYPeZCHNLjfD3fsByV7z50Nxv4Fu/encGA6GfcRo/MIign9GH2I4h /1zhRP4VVdmWD8Jlbo6k2+VFblqMBf8bliBBsblix2KaH6glU6PFLYGd+/of8/1mgRhA Xi561ojYk4uzaQB0CRmKLrZw8dyWEgmAtbwA8y8LuIWXOTuBNI3yAlYswLEmSBf8DhKc yHzEpwKYQyorlv9w44M/I6AdbBnZdKjWgttGza1Yb95a9XU5I4jCpjhDXRVvOJRlkjc/ Xrww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9SvND4Aoifwo+dUZ1S4WsTaPbsjIsvOLxsML72gE5gQ=; b=K37nSTGKEbYtjCfbjgOToc4J23CLOLtGW2mQTw/4L+wWcgn3Ba/SqR5Zbv+9hvxz51 FWSWbUx963+XhhoTFKYM6WTc12w2qQ+5NnoYebEJSqiji8RltnnLtkntUOGLt8l4kMjB Lzxsh8aCsBmrlIHmVmG4HCgOlGfnZHhOmBGdkx2Gf3wAjy9wb4AaFrSV9uco9OI/fVEU uixhb7C9afKRRO8r4M/Cu/qyRMvqRSRTulLEZ0mXMyn6kcHl5n2vSmkrTFdXA3ASsLNF zunkq6yBuPe2SxxnyXR+Nt6PALV1wTd9LTItP+CGLhguXqiDWRFFSgd0awzhzl92BYFb 9bZg== X-Gm-Message-State: AC+VfDxt0ho+cgf3RqAIDsWbdLKLnuVudA7uz2E83NeVqDR6iXQuqgZ7 Zii2HEN0xwM8zckWQwmZhdHngiB+fT9tD/L2Degnxw== X-Google-Smtp-Source: ACHHUZ7kOV86Q7cILymxN8rGTsBUaOH7XH/w8PzONPJ+YYIm4jy4s6HeFtbHPGsqLsNAUYpfYvvdtw== X-Received: by 2002:a05:600c:286:b0:3f6:69f:75e0 with SMTP id 6-20020a05600c028600b003f6069f75e0mr2373582wmk.25.1686062928326; Tue, 06 Jun 2023 07:48:48 -0700 (PDT) Received: from localhost.localdomain (5750a5b3.skybroadband.com. [87.80.165.179]) by smtp.gmail.com with ESMTPSA id o9-20020a05600c378900b003f7e4d143cfsm5722692wmr.15.2023.06.06.07.48.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 07:48:48 -0700 (PDT) From: Jean-Philippe Brucker To: kvm@vger.kernel.org, will@kernel.org Cc: Jean-Philippe Brucker Subject: [PATCH kvmtool 2/3] arm/kvm-cpu: Fix new build warning Date: Tue, 6 Jun 2023 15:37:35 +0100 Message-Id: <20230606143733.994679-3-jean-philippe@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606143733.994679-1-jean-philippe@linaro.org> References: <20230606143733.994679-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org GCC 13.1 complains about uninitialized value: arm/kvm-cpu.c: In function 'kvm_cpu__arch_init': arm/kvm-cpu.c:119:41: error: 'target' may be used uninitialized [-Werror=maybe-uninitialized] 119 | vcpu->cpu_compatible = target->compatible; | ~~~~~~^~~~~~~~~~~~ arm/kvm-cpu.c:40:32: note: 'target' was declared here 40 | struct kvm_arm_target *target; | ^~~~~~ This can't happen in practice (we call die() when no target is found), but initialize the target variable earlier to make GCC happy. Signed-off-by: Jean-Philippe Brucker --- arm/kvm-cpu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arm/kvm-cpu.c b/arm/kvm-cpu.c index 98bc5fdf..a43eb90a 100644 --- a/arm/kvm-cpu.c +++ b/arm/kvm-cpu.c @@ -37,7 +37,7 @@ int kvm_cpu__register_kvm_arm_target(struct kvm_arm_target *target) struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) { - struct kvm_arm_target *target; + struct kvm_arm_target *target = NULL; struct kvm_cpu *vcpu; int coalesced_offset, mmap_size, err = -1; unsigned int i; @@ -81,7 +81,6 @@ struct kvm_cpu *kvm_cpu__arch_init(struct kvm *kvm, unsigned long cpu_id) err = ioctl(kvm->vm_fd, KVM_ARM_PREFERRED_TARGET, &preferred_init); if (!err) { /* Match preferred target CPU type. */ - target = NULL; for (i = 0; i < ARRAY_SIZE(kvm_arm_targets); ++i) { if (!kvm_arm_targets[i]) continue; From patchwork Tue Jun 6 14:37:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Philippe Brucker X-Patchwork-Id: 13269325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B781AC77B7A for ; Tue, 6 Jun 2023 14:50:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238398AbjFFOu3 (ORCPT ); Tue, 6 Jun 2023 10:50:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238264AbjFFOto (ORCPT ); Tue, 6 Jun 2023 10:49:44 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 771612130 for ; Tue, 6 Jun 2023 07:48:50 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-3f7ebb2b82cso6776865e9.2 for ; Tue, 06 Jun 2023 07:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qP11BZ+0bYtN7sPX4Lr6yDDiHZvt0xfduE9tk3WmOqE=; b=dN1OOAWK0Ik3kTXBO7ewCWcD8TURSIsZhB7D5Y5uNkAKnmYXFZsnzdZnndRciP+nOp HJgR3cCI3tetqRFzRWfXOjH86qtjTmETOQgsEAWZhZksuRtdOlpQmUXh0EQvQFT/VtO2 N7HkhzWnB8ECfEC2IpzEac+q9dX/XXS771cHxvcFwgfdkIfo+IM53tbH6gFrhLL7CPFr EKtKPt4kBcNe8MjUPYPZUF8vAMl5+1OHCPvNxhu21i2Z3RIX6oV8n1t6pDC0CB9/P8uY Sa48rndUY72HwXtb/xRY7OWXOWpnnUZixP5K2p9o45z1iCoA6vS6X8dSE4caXbxcchiG H8Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686062928; x=1688654928; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qP11BZ+0bYtN7sPX4Lr6yDDiHZvt0xfduE9tk3WmOqE=; b=UeqvMrsrg4anb4Ibi4HvEru+JknPwfJjjTaIce1Q6G1lPO7GBQeEa6mpxbmwTS4+Zv DvULXVsh54yWaGtu7SgiwAmZJEHpC70ExJfBsanQs1tMQIRa2MwM3Qw1iy8wmQXy5wyo TgbV39lm0kf6tjFInTPupZH2jCM11rYT528vcH+gu+9BCgjIhUz++R7HgknLhhKDLcjZ 8jY3ZOrpcjslDeDnry7KFEYBFrcjz416vTo1WmW7p0TcoH+95mQQxK8GAuwSqqOVqlHg 1K8qTSKu1pzCRDKoDEeIkibtvXErsO+CptziMw/GEwp/l5ks0d55xu/UTg6IaFG0/fxZ /uTQ== X-Gm-Message-State: AC+VfDz7xfbulLoc7NY2w6G+ipUjWTy5FLsQIqsoE1i27IbooHcLio0F KwKAGyFKiJrQHruxOcHVcIKTMXB+XotPYYUSM8MFOQ== X-Google-Smtp-Source: ACHHUZ6sK5kYN/ko6anK9tUg81nrLVVeLiiSCWg2GET/SDQSDa6ii/AJanNWaPTWwlgW7oGkf4OMuQ== X-Received: by 2002:a7b:cc8e:0:b0:3f6:766:f76f with SMTP id p14-20020a7bcc8e000000b003f60766f76fmr2333166wma.36.1686062928801; Tue, 06 Jun 2023 07:48:48 -0700 (PDT) Received: from localhost.localdomain (5750a5b3.skybroadband.com. [87.80.165.179]) by smtp.gmail.com with ESMTPSA id o9-20020a05600c378900b003f7e4d143cfsm5722692wmr.15.2023.06.06.07.48.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 07:48:48 -0700 (PDT) From: Jean-Philippe Brucker To: kvm@vger.kernel.org, will@kernel.org Cc: Jean-Philippe Brucker Subject: [PATCH kvmtool 3/3] virtio/rng: Fix build warning from min() Date: Tue, 6 Jun 2023 15:37:36 +0100 Message-Id: <20230606143733.994679-4-jean-philippe@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230606143733.994679-1-jean-philippe@linaro.org> References: <20230606143733.994679-1-jean-philippe@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On a 32-bit build GCC complains about the min() parameters: include/linux/kernel.h:36:24: error: comparison of distinct pointer types lacks a cast [-Werror] 36 | (void) (&_min1 == &_min2); \ | ^~ virtio/rng.c:78:34: note: in expansion of macro 'min' 78 | iov[0].iov_len = min(iov[0].iov_len, 256UL); | ^~~ Use min_t() instead Fixes: bc23b9d9b152 ("virtio/rng: return at least one byte of entropy") Signed-off-by: Jean-Philippe Brucker --- virtio/rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/virtio/rng.c b/virtio/rng.c index 77a3a113..6b366552 100644 --- a/virtio/rng.c +++ b/virtio/rng.c @@ -75,7 +75,7 @@ static bool virtio_rng_do_io_request(struct kvm *kvm, struct rng_dev *rdev, stru * just retry here, with the requested size clamped to that * maximum, in case we were interrupted by a signal. */ - iov[0].iov_len = min(iov[0].iov_len, 256UL); + iov[0].iov_len = min_t(size_t, iov[0].iov_len, 256UL); len = readv(rdev->fd, iov, 1); if (len < 1) return false;