Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1257056pxb; Tue, 26 Oct 2021 05:48:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfc5QHpcYhgWUKK0vh3vMVQDCTcEw0QYC9BxrQx6VkR6JfeXJijNxYkaKk53yTNSylPru7 X-Received: by 2002:a50:d8ce:: with SMTP id y14mr35244965edj.92.1635252510586; Tue, 26 Oct 2021 05:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635252510; cv=none; d=google.com; s=arc-20160816; b=k1KigKr7RDa7gt9ogQiMwh1SSnWZ9Wnzbk+c1R4noDMGZL84GIHfyE8FUnLZne/GgO BvJV0SJ4HPGgy5qRM5wBY4aVpqofLFqPnCI16yeKxcgDY+TWV8/Vh1i5kEWZ/JXg3Yhf cgz3YI45fyEgYijF9+DZpuGolKi50HvLHMFuJD+YhlF82cdB01sEni4fWCocmDFXmp3Y C1X7OlWq2fCUuCEQLeDcK5J0wQRDkfa/N/b8mSQuGUkKuSSjRrATodcUsWV+mKJwNS+D CrVd/7LlPt3LzxQ5Zu56fFyuTzhxRkgB1nIwCa2HI2V7owJryeslO8uPnbu6p4AWLAwa 55eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=GGHc8NwY9iie4TGUTSBGJ2H0RkYgKDpuqIr5XMfy31w=; b=jerF1V8eOGsAeZDZuRttId/eWvLe+Ab7FXKWRKPZHlH9r+J854VrSlTWz1Ikjnfp9S 4TzmOXPQVTQAYXlezR9a+ACGtWruNAYank9iSCTGa3FPPz7Shx7prIvlHw7ixWvDLp6Z Jj/Kw2uRWzb0SFFN67kOF4uuClJrjAXU5BcGuyJnZ2cvNEViorANr+Y5SB0Cqx8jSP/I EApIDzJ+9GrTOm4wuiMlzCuvGNZch/S/RRhLs+2rIWNrg3uA5kaqDRPdl1n4u7NVNYys ryjsaxBInO0qUDr0qlpMSyftyfDiuQ+XrA/7Nv5jrkAL2FJKRVAWam3c312Hjd71Z7zF B+vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i25si397580ejd.625.2021.10.26.05.48.06; Tue, 26 Oct 2021 05:48:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231233AbhJZJry (ORCPT + 99 others); Tue, 26 Oct 2021 05:47:54 -0400 Received: from smtp23.cstnet.cn ([159.226.251.23]:58870 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230431AbhJZJrs (ORCPT ); Tue, 26 Oct 2021 05:47:48 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-03 (Coremail) with SMTP id rQCowACniOUizndhFLj+BA--.21179S2; Tue, 26 Oct 2021 17:45:06 +0800 (CST) From: Jiasheng Jiang To: andraprs@amazon.com, lexnv@amazon.com, alcioa@amazon.com Cc: linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] nitro_enclaves: Fix implicit type conversion Date: Tue, 26 Oct 2021 09:45:04 +0000 Message-Id: <1635241504-2591251-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: rQCowACniOUizndhFLj+BA--.21179S2 X-Coremail-Antispam: 1UD129KBjvdXoWrKFy5GFyktw1kuw4xuF1ftFb_yoWktFg_Cr n8Xr409r9Fkrn2vF17CF4fArWaka45WF4aqayagrn3Z34IvF43uwn2vryjvr1xW3y5ZFsx ZFy7tw1rZryxWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbckFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_ Cr1l84ACjcxK6I8E87Iv67AKxVWxJr0_GcWl84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8uwCF 04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r 18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vI r41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr 1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF 0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUIhFcUUUUU= X-Originating-IP: [124.16.138.128] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The variable 'cpu' is defined as unsigned int. However in the for_each_cpu, its value is assigned to -1. That doesn't make sense and in the cpumask_next() it is implicitly type conversed to int. It is universally accepted that the implicit type conversion is terrible. Also, having the good programming custom will set an example for others. Thus, it might be better to change the definition of 'cpu' from unsigned int to int. Fixes: ff8a4d3 ("nitro_enclaves: Add logic for setting an enclave vCPU") Signed-off-by: Jiasheng Jiang --- drivers/virt/nitro_enclaves/ne_misc_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/virt/nitro_enclaves/ne_misc_dev.c b/drivers/virt/nitro_enclaves/ne_misc_dev.c index e21e1e8..38d1fd9 100644 --- a/drivers/virt/nitro_enclaves/ne_misc_dev.c +++ b/drivers/virt/nitro_enclaves/ne_misc_dev.c @@ -168,7 +168,7 @@ static bool ne_check_enclaves_created(void) static int ne_setup_cpu_pool(const char *ne_cpu_list) { int core_id = -1; - unsigned int cpu = 0; + int cpu = 0; cpumask_var_t cpu_pool; unsigned int cpu_sibling = 0; unsigned int i = 0; -- 2.7.4