From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E2F13C455B for ; Fri, 26 Jun 2026 22:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782513507; cv=none; b=hpRyld2n5vSr3e95CGb+kpyKVo60cVpz6e8s6c2qJ0RVLpvdeBph5+E8jItBO31Os5w0I16dRJ0B05M1WFU1y/vQW6Mzl71iPbODDpU/Mh4aItT2pm8R2xf1JaHo/HWlzyOkxcILaAQf8cJAUE/XV6aVX/Hy/t0+lkb57SlRsQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782513507; c=relaxed/simple; bh=cPAVerSpX75fsqC6ot/4ft9CSETqQev+zyx+EVdLVtE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TZdxqLvQLv8E0GBEfrEbMjJZypJeV3JIQ0CLGQ2zz8J1eei50UrFJkhXPVgJ0vORKIxr2n3sdgPMlsn9oa2iaaBng3kGbY7kjcw8rkTUnTVkkZingI1iYQkK80eNOinmc0ZccNVFRqCs48xyBH5s3KiV3j2djuqw9c34tJARhCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=rQPDFeRN; arc=none smtp.client-ip=209.85.128.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rQPDFeRN" Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-80cd342a796so3388137b3.0 for ; Fri, 26 Jun 2026 15:38:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782513505; x=1783118305; darn=vger.kernel.org; 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=BBo303ZgWe06b+c3DpyLbageNFD263eKZHcTV1IiJqg=; b=rQPDFeRN1GVqdZLDnkL9hEfDj83C1Cy9wbJ0MqHNPTe/kxezlAEVoCsc4/q8o1qQfa 46KaQ1ZQ28FRVa8Q+4ekLxRZQMmlgXVaH+RiQPJQRTrGpguPF4DV0pNiZmbgcopIhhTc MKPAIwEm83KaxEt82/o0K+A6bgH+XS6Lkei41b0vnSsMPaKhWooAahWEHu82A+uiWDFJ TNpXAR1B55c1oCBxkvwkIe0vDD89qNvY9Frg2OJMerUBbAlvBiP3S/puBxlYQmkYBocL 0+Ups55VgwTrDnF6Wv7n6s36mo/fWSI1OHEz/NPULcn7hgWuzsebBNmbu02BOCOp1gms 3Luw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782513505; x=1783118305; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BBo303ZgWe06b+c3DpyLbageNFD263eKZHcTV1IiJqg=; b=NG7x6LpSs70rcCISuUdXZB1OQLdcEWlerzkk0jYkDkw7s3Jd5d0RFU5+GC2CGNd9t3 03jHFNXzSADmhO63GSsOjvQjxosSJ4Aqd3HomwxxtYhYs5GpBlm2IGYgoaCFQxD/hXi5 SeCg+BIJj78l6nXgSUZDnLulLQBGPPeGvmEfk3bsksSyms1b+sE41qU7X+ZJGwJFzjVZ 4SSzgc27LY4uuWauJvvfldU3g0myZOLoerxwZkZpzON9HZKJsdyvOVhLrd1mg7IK3Edx KYneMd50AOVtCIeR2H7RL0a5f6pdF1zlaDsc6pbJVQzp9a5ytYN5AXTe0MS8l4r/O37s ACYQ== X-Forwarded-Encrypted: i=1; AHgh+RoD8qe095Jwtof9oeoF+MxOGlTDJvVhVhPprBYLzu90nKdrNJUMw94RARQUcHkGq8SnPRub6jIh2FWh6Ds=@vger.kernel.org X-Gm-Message-State: AOJu0Ywe5RQbHTzHG2KuETlhNBz5ETCjP3WdeYhkIpulxFHzAaqOGpWK WA9PecmwYTdYp0zXeYDVcsQSwAmNROHj9yo0IeEJBB/whE1QDFFOgoLY X-Gm-Gg: AfdE7cmCMAHxA8eIkyjoCiIbDOzHmiEt9rOpNjoYFUy7fuAegBJP+DhA+2AwUc2aau3 JjQzNh+SBEIVYOMtMof4aYGaM6jLAFmzO9sv+qUJUbViC3XSTJrx7w1UrcxwzisEfYmaxiGgjXq E50EwR9ySVu37mbdzXuw8XX5RU0A3uWc29vtyw3XMFpJTKPdPlcxqzvfebfuor8v0UrNU1Rt+Eh t2cnsO+cYoa7lmkUTvQ+weitCt8xwCokVarrj9dXbuDfJTy98axYg3Gcpk3Mr+DSkf5fniAG6pt 3FH2zWeYoTSxRq0qh/0WjbEVkdGQtNiawogJ4OHPRkgBS6XHTHKJhRF4LHrmAtekg9P+slWk5cY aw+q2DtrhgUZiBZIeJ7U8UOAKXMmklKltw4upnD6ZI9NFoLZt/C+DZdMYU2UG+emZeuQB/3nSLS b0FZHt8sSj4iYcGH+qh2ym6sLGUAWj4cp+U64o X-Received: by 2002:a05:690c:7243:b0:80c:85b6:75b0 with SMTP id 00721157ae682-80c85b68489mr22744667b3.57.1782513505253; Fri, 26 Jun 2026 15:38:25 -0700 (PDT) Received: from Dev-Null-MSI ([2a0d:3344:52ac:a808:98a4:4381:be45:536f]) by smtp.gmail.com with ESMTPSA id 00721157ae682-80abc3d1734sm23177557b3.15.2026.06.26.15.38.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 15:38:24 -0700 (PDT) From: Yousef Alhouseen To: Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Yousef Alhouseen Subject: [PATCH v2 1/2] xen/gntalloc: make grant counters unsigned Date: Sat, 27 Jun 2026 00:38:04 +0200 Message-ID: <20260626223805.43781-2-alhouseenyousef@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260626223805.43781-1-alhouseenyousef@gmail.com> References: <20260624124745.10073-1-alhouseenyousef@gmail.com> <20260626223805.43781-1-alhouseenyousef@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The module limit and current allocation count cannot validly be negative. Give both variables unsigned types so their representation matches the u32 grant count supplied through the ioctl and negative module parameter values are rejected by parameter parsing. This also prepares the limit check for overflow-safe unsigned arithmetic. Signed-off-by: Yousef Alhouseen --- drivers/xen/gntalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/xen/gntalloc.c b/drivers/xen/gntalloc.c index eadedd1e9..9279f1521 100644 --- a/drivers/xen/gntalloc.c +++ b/drivers/xen/gntalloc.c @@ -70,14 +70,14 @@ #include #include -static int limit = 1024; -module_param(limit, int, 0644); +static unsigned int limit = 1024; +module_param(limit, uint, 0644); MODULE_PARM_DESC(limit, "Maximum number of grants that may be allocated by " "the gntalloc device"); static LIST_HEAD(gref_list); static DEFINE_MUTEX(gref_mutex); -static int gref_size; +static unsigned int gref_size; struct notify_info { uint16_t pgoff:12; /* Bits 0-11: Offset of the byte to clear */ -- 2.54.0