public inbox for kernelnewbies@kernelnewbies.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Sotir Danailov <sndanailov@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Typecasting a void pointer to unsigned long in zsmalloc.c
Date: Thu, 23 Jan 2025 16:59:18 +0100	[thread overview]
Message-ID: <2025012321-fool-blatantly-069a@gregkh> (raw)
In-Reply-To: <CACYkWJ5fudSHYxdw2OWM=BgcaeTBOp_f-A_DoyCxaYAceZ=7PQ@mail.gmail.com>

On Thu, Jan 23, 2025 at 04:52:24PM +0100, Sotir Danailov wrote:
> What's the guarantee that an unsigned long can hold the data
> from the void pointer?

This is a requirement that Linux makes for the compiler to work with
it for any platform that Linux runs on.

> Is this safe to do?

Yes.

> Shouldn't there be a special type for doing this type of conversion?

That type is "unsigned long" :)

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2025-01-23 16:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-23 15:52 Typecasting a void pointer to unsigned long in zsmalloc.c Sotir Danailov
2025-01-23 15:59 ` Greg KH [this message]
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
     [not found] <mailman.1.1737651601.26911.kernelnewbies@kernelnewbies.org>
2025-01-23 17:58 ` Alex Hogen
2025-01-23 18:23   ` Greg KH

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=2025012321-fool-blatantly-069a@gregkh \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=sndanailov@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox