lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 31 May 2012 17:43:44 -0400
From:	John Moser <john.r.moser@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Is this code right in zram?

before I go stomping all over other peoples' work and sending idiotic 
patches, I think I'll ask.  Since I have no clue what I'm doing.

in drivers/staging/zram.c out of 3.4 (I just grabbed the source hours 
ago), I see this on lines 810-822:

        /* Allocate the device array and initialize each one */
         pr_info("Creating %u devices ...\n", num_devices);
         zram_devices = kzalloc(num_devices * sizeof(struct zram), 
GFP_KERNEL);
         if (!zram_devices) {
                 ret = -ENOMEM;
                 goto unregister;
         }

         for (dev_id = 0; dev_id < num_devices; dev_id++) {
                 ret = create_device(&zram_devices[dev_id], dev_id);
                 if (ret)
                         goto free_devices;
         }

Curiosity got me to here:

http://lwn.net/Articles/147014/

So assuming this, what I see here is:

  - kmalloc(num_devices * sizeof(struct zram), GFP_KERNEL);
  - memset() that to 0
  - immediately fill in this RAM without reading it

I'm wondering what the immediate need is to fill the area with zeros?  
Also curious as to whether the kzalloc() thing should better be 
kcalloc(num_devices, sizeof(struct zram), GFP_KERNEL) as a matter of 
convention.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ