From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 AECBE3A452E for ; Tue, 30 Jun 2026 09:24:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782811463; cv=none; b=bKc/aaD0zX0dicCb6WaKbVBFUv3pNV933HAL4SSwbGlNnL0bPOC22QBQt1KmIXoHFY55ddIZvL05HKBJnbve1WuGDlMh+z261t/VAzN4vhrnAo3NfgeTZN1N5DIOgci7Yyllq84Oz2Y1XiO1NE9/LXH47MDpmz6eIYuAVRnXBME= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782811463; c=relaxed/simple; bh=wV+J880CYhYps8GjdQeuTJlZNZZl4nfz6w3Jn72gjhM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=aPDvTk6C0q02FB6KD9dO2Hj/NxMYpzvx7IfB0ffjuWIHZF1SvJ5N3N2kiORK1nlAlTST/2owTSKtRIRjbVXbknB19dzfJoDLAQiA36ldPEIUzWV+TP42PrdviYxliveYMrhqEcpnytY0aJKq9XQNGcD/fpQ/HHf3Shhv/6JESqs= 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=X+mgT0Kw; arc=none smtp.client-ip=209.85.208.169 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="X+mgT0Kw" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-39b1f588471so5076921fa.0 for ; Tue, 30 Jun 2026 02:24:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782811457; x=1783416257; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=u6vaaCp8EQ/A3HpauMaQ9iqlZuykj9gCQu3yAh2/OOg=; b=X+mgT0KwmzwF3B9w/YZ4yO/N+42kqoIp+1ZFXqw8w3IHKODG5GsmnRTD7h1PgZDKoC vnkk5ouGZV7Z68Qa4Ywh5FOjDiDjZJw1P/Mu3qyOJFCIyRrvVGVuzVSDo3fnDUqlPuiX JouOpV2zkKBYtl7bq9te8UKsXqU6nAzO9XGHLtA4RJnAajsBaHS0Z5B8URdEk+tV3N4k QUxI+H9kpfKGxEcgGuWFn1OhRFsfdahsbqeLgUy2tzAbw0D5o+htp1neqY4YFoB1oOAr MlpvueqJslpZpIjXus8Ap056tW9IXAcbP7/kMuO+OdpIKxZaJOGR6JCXIsY1ViJ2XFxu acSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782811457; x=1783416257; h=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=u6vaaCp8EQ/A3HpauMaQ9iqlZuykj9gCQu3yAh2/OOg=; b=Y8Y7yJ+rEktF1n6dU4fLYCP7RaC5CvAKByb2prpQa8aS1MitFlKAXBSEizEqGCnL6N ELMvf6tdNiW4G6T4xRKqhCgF0+7ct08izwTk1WNxGfm34i9ExDiaAveUhHgxoRqbiD1g v11PYnKLUZqax2WmtCHfZkLIdUhXSyNez+/6blxJEI2e1bbpIUcGlQt7LvVd0YN+VZh2 XX8s9XgxoG0wOU2DNQmgpCcvuGCBmfycYLQAyeLTm5wPB7beGfgUAlhfsFXAoXU1e7eb il9y1pLVNc8NHEwkH/4JxZXpPysaZVjvw5u2MGD5yrlXcn481en2DzDdXCJM3DWUNiEA 4THA== X-Forwarded-Encrypted: i=1; AHgh+RrMmwJeff1cCbd9LL12G7hllNa1BbS03coGlLQ6WC9I9ckk2btu7Qb4d5KSkfKFOd5wN4iff/h+Ay8zfY8=@vger.kernel.org X-Gm-Message-State: AOJu0YwtU2Sq+WTBMCWIFEVzU6oaaQPac49vsZLm/H9XaQufSGxccdnW l0vehHdZceutIp+G5lxbfIKxfopbzHQkvo4U+N9w5iOAz1iBhZWDrwQ+ X-Gm-Gg: AfdE7clYSSAFW01tZke/dgn9FLoO+Cr/q2lqLQyjEU74QnWroYecRLm24XC8Woptb9+ 4YkQXAWxm5RkAuSGyLOIQsuj6sB6BVqSoC1jLRB7yNrGiYWDmQsCnALl9qewo+ncSv/HYmbJf8J eL3Y2W5D+MZCOP9iJaZhgIDlmAlwlT6MMsJemyTbfLXkvweqqvRkuW9eCxd5+dOr5lXZ7k0pUo9 lkRjZu4v7ynJKKkanN41h41O0tyB2Z43xCtuFuncvriWQjucYaWsstzBxwWC/Aiwl7tWDKq0V7p D2eIxGmuL3riw7CI23Xn5HNL2eYUOvYGgP51eRV2SPu0jjJZl8NmueILoA1xai0xQ55i4OgWgMS d+9i1HdB/JcvTRcFCstTiih26ILVon0E6TykWrvzFYn00eP9cJMnq0iyUScs2S7/j70rF6rowXd EiPDXBBiug1KRmKhL0gGgb4K//KtW29kWbQavV8mwJ X-Received: by 2002:a05:6512:8050:b0:5ae:bd1f:c831 with SMTP id 2adb3069b0e04-5aebdba120fmr510481e87.16.1782811457421; Tue, 30 Jun 2026 02:24:17 -0700 (PDT) Received: from localhost (c-85-228-45-68.bbcust.telenor.se. [85.228.45.68]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5aebe4984ecsm429731e87.48.2026.06.30.02.24.15 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 30 Jun 2026 02:24:16 -0700 (PDT) From: Eli Billauer To: gregkh@linuxfoundation.org Cc: arnd@arndb.de, linux-kernel@vger.kernel.org, Eli Billauer Subject: [PATCH 5/7] char: xillybus: Integer arithmetic improvements Date: Tue, 30 Jun 2026 11:23:28 +0200 Message-Id: <20260630092330.43534-6-eli.billauer@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20260630092330.43534-1-eli.billauer@gmail.com> References: <20260630092330.43534-1-eli.billauer@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Choose unsigned integers instead of signed where natural, and also ensure overflow wraps as expected. Simplify an arithmetic expression too. No functional change is expected, as the relevant variables normally never reach values where this transition matters. Signed-off-by: Eli Billauer --- drivers/char/xillybus/xillybus_core.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/char/xillybus/xillybus_core.c b/drivers/char/xillybus/xillybus_core.c index 7acebc1e6050..b264578b2572 100644 --- a/drivers/char/xillybus/xillybus_core.c +++ b/drivers/char/xillybus/xillybus_core.c @@ -343,7 +343,8 @@ static int xilly_map_single(struct xilly_endpoint *ep, static int xilly_get_dma_buffers(struct xilly_endpoint *ep, struct xilly_alloc_state *s, struct xilly_buffer **buffers, - int bufnum, int bytebufsize) + unsigned int bufnum, + unsigned int bytebufsize) { int i, rc; dma_addr_t dma_addr; @@ -431,8 +432,8 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, struct device *dev = ep->dev; int i, entry, rc; struct xilly_channel *channel; - int channelnum, bufnum, bufsize, format, is_writebuf; - int bytebufsize; + unsigned int channelnum, bufnum, bufsize, format, is_writebuf; + unsigned int bytebufsize; int synchronous, allowpartial, exclusive_open, seekable; int supports_nonempty; int msg_buf_done = 0; @@ -531,8 +532,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, channel->log2_element_size = ((format > 2) ? 2 : format); - bytebufsize = bufsize * - (1 << channel->log2_element_size); + bytebufsize = bufsize << channel->log2_element_size; buffers = devm_kcalloc(dev, bufnum, sizeof(struct xilly_buffer *), @@ -589,7 +589,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, static int xilly_scan_idt(struct xilly_endpoint *endpoint, struct xilly_idt_handle *idt_handle) { - int count = 0; + unsigned int count = 0; unsigned char *idt = endpoint->channels[1]->wr_buffers[0]->addr; unsigned char *end_of_idt = idt + endpoint->idtlen - 4; unsigned char *scan; -- 2.34.1