From: Greg KH <greg@kroah.com>
To: Alex Hogen <alex@edt.com>
Cc: "kernelnewbies@kernelnewbies.org" <kernelnewbies@kernelnewbies.org>
Subject: Re: Typecasting a void pointer to unsigned long in zsmalloc.c
Date: Thu, 23 Jan 2025 19:23:33 +0100 [thread overview]
Message-ID: <2025012338-macarena-caliber-17e6@gregkh> (raw)
In-Reply-To: <CH0PR16MB4497FDD0D1D422038CFB70A5D0E02@CH0PR16MB4497.namprd16.prod.outlook.com>
On Thu, Jan 23, 2025 at 05:58:10PM +0000, Alex Hogen wrote:
> >> Shouldn't there be a special type for doing this type of conversion?
>
> > That type is "unsigned long" :)
>
> Wouldn't "uintptr_t" be a more explicit type for storing pointer addresses as integers? It seems to me it has the advantage of expressing intent better for us human readers. See <linux/types.h>. Yes, it is currently defined as an "unsigned long."
"unitptr_t" came years, if not decades, after the policy of "a pointer
fits into an unsigned long" was the rule (i.e. from the very first
release of Linux.
And those crazy _t types are for userspace code, don't use them in the
kernel, there's no need.
thanks,
greg k-h
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2025-01-23 18:48 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1737651601.26911.kernelnewbies@kernelnewbies.org>
2025-01-23 17:58 ` Typecasting a void pointer to unsigned long in zsmalloc.c Alex Hogen
2025-01-23 18:23 ` Greg KH [this message]
2025-01-23 15:52 Sotir Danailov
2025-01-23 15:59 ` Greg KH
2025-01-23 16:27 ` Sotir Danailov
2025-01-23 17:00 ` Greg KH
2025-01-23 17:05 ` Sotir Danailov
2025-01-23 17:40 ` Leam Hall
2025-01-23 18:30 ` Sotir Danailov
2025-01-23 19:54 ` Leam Hall
2025-01-23 20:48 ` Sotir Danailov
2025-01-23 21:09 ` Costa Shulyupin
2025-01-24 5:13 ` Greg KH
2025-01-24 21:45 ` Sotir Danailov
2025-01-26 23:29 ` Leam Hall
2025-01-27 10:39 ` Sotir Danailov
2025-01-27 13:48 ` Leam Hall
2025-01-28 8:45 ` Sotir Danailov
2025-01-28 8:58 ` Costa Shulyupin
2025-01-28 9:14 ` Sotir Danailov
2025-01-28 9:24 ` Sotir Danailov
2025-01-28 10:23 ` Leam Hall
2025-01-23 18:44 ` jim.cromie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2025012338-macarena-caliber-17e6@gregkh \
--to=greg@kroah.com \
--cc=alex@edt.com \
--cc=kernelnewbies@kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.