<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/fs/pstore/zone.c, branch linux-7.1.y</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=linux-7.1.y'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-02-22T01:09:51+00:00</updated>
<entry>
<title>Convert 'alloc_obj' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T00:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43'/>
<id>urn:sha1:bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43</id>
<content type='text'>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace kmalloc with kmalloc_obj for non-scalar types</title>
<updated>2026-02-21T09:02:28+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-21T07:49:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69050f8d6d075dc01af7a5f2f550a8067510366f'/>
<id>urn:sha1:69050f8d6d075dc01af7a5f2f550a8067510366f</id>
<content type='text'>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>pstore/zone: rewrite some comments for better understanding</title>
<updated>2025-05-09T19:09:58+00:00</updated>
<author>
<name>Eugen Hristev</name>
<email>eugen.hristev@linaro.org</email>
</author>
<published>2025-01-17T08:42:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d679c2e1e8d96f71f85e2ef3877407d264212cc3'/>
<id>urn:sha1:d679c2e1e8d96f71f85e2ef3877407d264212cc3</id>
<content type='text'>
Rewrite some comments to make it more clear and easier to understand;
fix typos.

Signed-off-by: Eugen Hristev &lt;eugen.hristev@linaro.org&gt;
Link: https://lore.kernel.org/r/20241224154405.295840-1-eugen.hristev@linaro.org
Link: https://lore.kernel.org/r/20250117084228.3218024-1-eugen.hristev@linaro.org
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>pstore/zone: avoid dereferencing zero sized ptr after init zones</title>
<updated>2025-01-10T16:51:46+00:00</updated>
<author>
<name>Eugen Hristev</name>
<email>eugen.hristev@linaro.org</email>
</author>
<published>2025-01-10T12:57:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=067cdf020329a07dd8ee1574c3086998343b1b2b'/>
<id>urn:sha1:067cdf020329a07dd8ee1574c3086998343b1b2b</id>
<content type='text'>
In psz_init_zones, if the requested area has a total_size less than
record_size, kcalloc will be called with c == 0 and will return
ZERO_SIZE_PTR.
Further, this will lead to an oops.

With this patch, in this scenario, it will look like this :
[    6.865545] pstore_zone:     total size : 28672 Bytes
[    6.865547] pstore_zone:     kmsg size : 65536 Bytes
[    6.865549] pstore_zone:     pmsg size : 0 Bytes
[    6.865551] pstore_zone:     console size : 0 Bytes
[    6.865553] pstore_zone:     ftrace size : 0 Bytes
[    6.872095] pstore_zone: zone dmesg total_size too small
[    6.878234] pstore_zone: alloc zones failed

Signed-off-by: Eugen Hristev &lt;eugen.hristev@linaro.org&gt;
Link: https://lore.kernel.org/r/20250110125714.2594719-1-eugen.hristev@linaro.org
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>pstore/zone: Don't clear memory twice</title>
<updated>2024-03-09T20:33:22+00:00</updated>
<author>
<name>Christophe JAILLET</name>
<email>christophe.jaillet@wanadoo.fr</email>
</author>
<published>2024-03-09T08:24:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c8d25d696f526a42ad8cf615dc1131c0b00c662e'/>
<id>urn:sha1:c8d25d696f526a42ad8cf615dc1131c0b00c662e</id>
<content type='text'>
There is no need to call memset(..., 0, ...) on memory allocated by
kcalloc(). It is already zeroed.

Remove the redundant call.

Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Link: https://lore.kernel.org/r/fa2597400051c18c6ca11187b0e4b906729991b2.1709972649.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore/zone: Add a null pointer check to the psz_kmsg_read</title>
<updated>2024-02-22T18:37:22+00:00</updated>
<author>
<name>Kunwu Chan</name>
<email>chentao@kylinos.cn</email>
</author>
<published>2024-01-18T10:02:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=98bc7e26e14fbb26a6abf97603d59532475e97f8'/>
<id>urn:sha1:98bc7e26e14fbb26a6abf97603d59532475e97f8</id>
<content type='text'>
kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure. Ensure the allocation was successful
by checking the pointer validity.

Signed-off-by: Kunwu Chan &lt;chentao@kylinos.cn&gt;
Link: https://lore.kernel.org/r/20240118100206.213928-1-chentao@kylinos.cn
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
</content>
</entry>
<entry>
<title>pstore/zone: Use GFP_ATOMIC to allocate zone buffer</title>
<updated>2022-10-17T20:14:10+00:00</updated>
<author>
<name>Qiujun Huang</name>
<email>hqjagain@gmail.com</email>
</author>
<published>2022-09-04T15:17:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=99b3b837855b987563bcfb397cf9ddd88262814b'/>
<id>urn:sha1:99b3b837855b987563bcfb397cf9ddd88262814b</id>
<content type='text'>
There is a case found when triggering a panic_on_oom, pstore fails to dump
kmsg. Because psz_kmsg_write_record can't get the new buffer.

Handle this by using GFP_ATOMIC to allocate a buffer at lower watermark.

Signed-off-by: Qiujun Huang &lt;hqjagain@gmail.com&gt;
Fixes: 335426c6dcdd ("pstore/zone: Provide way to skip "broken" zone for MTD devices")
Cc: WeiXiong Liao &lt;gmpy.liaowx@gmail.com&gt;
Cc: stable@vger.kernel.org
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/CAJRQjofRCF7wjrYmw3D7zd5QZnwHQq+F8U-mJDJ6NZ4bddYdLA@mail.gmail.com
</content>
</entry>
<entry>
<title>pstore/zone: cleanup "rcnt" type</title>
<updated>2022-06-23T15:27:52+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2022-06-23T13:40:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2c09d1443b9b8b6e25bfb2acf51ad442cf9b314e'/>
<id>urn:sha1:2c09d1443b9b8b6e25bfb2acf51ad442cf9b314e</id>
<content type='text'>
The info-&gt;read() function returns ssize_t.  That means that info-&gt;read()
either returns either negative error codes or a positive number
representing the bytes read.

The "rcnt" variable should be declared as ssize_t as well.  Most places
do this correctly but psz_kmsg_recover_meta() needed to be fixed.

This code casts the "rcnt" to int.  That is unnecessary when "rcnt"
is already signed.  It's also slightly wrong because if info-&gt;read()
returned a very high (more than INT_MAX) number of bytes then this might
treat that as an error.  This bug cannot happen in real life, so it
doesn't affect run time, but static checkers correctly complain that it
is wrong.

fs/pstore/zone.c:366 psz_kmsg_recover_data() warn: casting 'rcnt' truncates high bits

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/YrRtPSFHDVJzV6d+@kili
</content>
</entry>
<entry>
<title>pstore/zone: fix a kernel-doc markup</title>
<updated>2021-01-21T21:06:00+00:00</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab+huawei@kernel.org</email>
</author>
<published>2021-01-14T08:04:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4fd15eaf429a1e7de9d653f0ff2e8a50733495b8'/>
<id>urn:sha1:4fd15eaf429a1e7de9d653f0ff2e8a50733495b8</id>
<content type='text'>
The documented struct is psz_head and not psz_buffer.

Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+huawei@kernel.org&gt;
Link: https://lore.kernel.org/r/a67ca4d12c3ef277dadb9e0d0df8450158e637cc.1610610937.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>pstore/zone: cap the maximum device size</title>
<updated>2020-12-01T19:32:55+00:00</updated>
<author>
<name>Christoph Hellwig</name>
<email>hch@lst.de</email>
</author>
<published>2020-10-16T13:20:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cbf82e35031b135928f36e72c6d166e935530b6a'/>
<id>urn:sha1:cbf82e35031b135928f36e72c6d166e935530b6a</id>
<content type='text'>
Introduce an abritrary 128MiB cap to avoid malloc failures when using
a larger block device.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: WeiXiong Liao &lt;gmpy.liaowx@gmail.com&gt;
Reviewed-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Link: https://lore.kernel.org/r/20201016132047.3068029-2-hch@lst.de
</content>
</entry>
</feed>
