<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/misc-utils, branch v2.3.0</title>
<subtitle>A mirror of http://git.infradead.org/mtd-utils.git</subtitle>
<id>https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.0</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.0'/>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/'/>
<updated>2025-01-30T17:30:16+00:00</updated>
<entry>
<title>misc-utils: flashcp: Fix uninitialized variable ‘wrlast_buf’ compiling warning</title>
<updated>2025-01-30T17:30:16+00:00</updated>
<author>
<name>Zhihao Cheng</name>
<email>chengzhihao1@huawei.com</email>
</author>
<published>2025-01-26T06:41:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=555a652dfe40619fd316ff7016570734450daf44'/>
<id>urn:sha1:555a652dfe40619fd316ff7016570734450daf44</id>
<content type='text'>
The compiler compains following message:
 misc-utils/flashcp.c:439:3: warning: ‘wrlast_buf’ may be used
 uninitialized in this function
It won't bring any problems because variable '‘wrlast_buf’ is always
initialized before being used. Fix the warning by setting 'wrlast_buf'
as NULL when declaring it.

Signed-off-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>misc-utils: add missing error handling for 'bam' allocation in ftl_check.c</title>
<updated>2024-12-20T17:35:13+00:00</updated>
<author>
<name>Anton Moryakov</name>
<email>ant.v.moryakov@gmail.com</email>
</author>
<published>2024-12-19T13:51:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=117efd252bc485084a609c405c312f5a9229e25a'/>
<id>urn:sha1:117efd252bc485084a609c405c312f5a9229e25a</id>
<content type='text'>
Corrections explained:
Added robust handling for malloc() failure by checking the returnvalueand providing a clear error message.

Triggers found by static analyzer Svace.

Signed-off-by: Anton Moryakov &lt;ant.v.moryakov@gmail.com&gt;
Reviewed-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>misc-utils: flash_erase: FIX integer overflow in flash_erase.c</title>
<updated>2024-12-17T13:34:22+00:00</updated>
<author>
<name>Anton Moryakov</name>
<email>ant.v.moryakov@gmail.com</email>
</author>
<published>2024-12-11T14:04:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=cf3b826cac649caac853bc319b19be133372166f'/>
<id>urn:sha1:cf3b826cac649caac853bc319b19be133372166f</id>
<content type='text'>
Report of the static analyzer:
The value of an arithmetic expression 'eb_cnt * mtd.eb_size' is a subject to overflow because its operands are not cast to a larger data type before performing arithmetic

Corrections explained:
Added explicit casting of eb_cnt to long long in the condition
if (eb_start == 0 &amp;&amp; mtd.size == eb_cnt * mtd.eb_size)
to ensure the multiplication is performed in a 64-bit context,
preventing potential overflow for large values of eb_cnt and mtd.eb_size.
This ensures correct handling of devices with large block counts or block sizes.

Triggers found by static analyzer Svace.

Signed-off-by: Anton Moryakov &lt;ant.v.moryakov@gmail.com&gt;
Reviewed-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: fectest: Fix time formatting with _TIME_BITS=64 on 32-bit system</title>
<updated>2024-04-13T14:26:37+00:00</updated>
<author>
<name>Ben Hutchings</name>
<email>ben.hutchings@mind.be</email>
</author>
<published>2024-04-12T20:55:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=cc7af09ae09ae20565e61f7d33b5ec0329797647'/>
<id>urn:sha1:cc7af09ae09ae20565e61f7d33b5ec0329797647</id>
<content type='text'>
fectest.c formats a struct timeval with the assumption that time_t and
suseconds_t are aliases for long, but some 32-bit systems now define
them as long long in order to support timestamps beyond 2038.

As this is an elapsed time and not a timestamp, both fields should be
within the range of long, so cast them to long before formatting
rather than moving to long long.

Signed-off-by: Ben Hutchings &lt;ben.hutchings@mind.be&gt;
Reviewed-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: flash_erase: Add an option for JFFS2 cleanmarker size</title>
<updated>2023-11-13T08:03:00+00:00</updated>
<author>
<name>Takahiro Kuwano</name>
<email>Takahiro.Kuwano@infineon.com</email>
</author>
<published>2023-11-07T09:23:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=71edfe3b5a51ea9a7fac9760804db328ea1ec8a0'/>
<id>urn:sha1:71edfe3b5a51ea9a7fac9760804db328ea1ec8a0</id>
<content type='text'>
JFFS2 supports buffer mode for ECC'd NOR Flash that cleanmarker size
is rounded up to mtd-&gt;writesize, while the '-j' option in flash_erase
utility uses fixed 12 bytes. That makes flash program ops unaligned to
mtd-&gt;writesize and causes program error or disables ECC.

The mkfs.jffs2 utility supports '-c' option that allows users to specify
cleanmarker size. This patch implements '-c' option in the flash_erase
that can be used along with '-j' option.

Signed-off-by: Takahiro Kuwano &lt;Takahiro.Kuwano@infineon.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>flashcp: Add write last option.</title>
<updated>2023-09-08T11:48:52+00:00</updated>
<author>
<name>Piotr Esden-Tempski</name>
<email>piotr@esden.net</email>
</author>
<published>2023-09-01T00:55:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=aaa77f94ce6e03d9730f62004347ec2bbf11cfb1'/>
<id>urn:sha1:aaa77f94ce6e03d9730f62004347ec2bbf11cfb1</id>
<content type='text'>
This option is useful for power fail resilient bootloader updates, for
systems that check only the partition header for validity before
attempting to load the bootloader. For example zynq.

Postponing the write of a specified amount of bytes at the beginning of
a bootloader makes sure a written bootloader slot is not considered
valid until all the data is written.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>mtd-utils: Add new syntax to get devices by name</title>
<updated>2023-05-30T09:12:12+00:00</updated>
<author>
<name>Brandon Maier</name>
<email>brandon.maier@collins.com</email>
</author>
<published>2022-12-12T18:01:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=730148bc94411f13a0171204e872b0760fbde185'/>
<id>urn:sha1:730148bc94411f13a0171204e872b0760fbde185</id>
<content type='text'>
This introduces a new feature to the MTD command line utilities that
allows MTD devices to be referenced by name instead of device node. For
example this looks like:

&gt; # Display info for the MTD device with name "data"
&gt; mtdinfo mtd:data
&gt; # Copy file to MTD device with name "data"
&gt; flashcp /my/file mtd:data

This follows the syntax supported by the kernel which allows MTD
device's to be mounted by name[1].

Add the function mtd_find_dev_node() that accepts an MTD "identifier"
and returns the MTD's device node. The function accepts a string
starting with "mtd:" which it treats as the MTD's name. It then attempts
to search for the MTD, and if found maps it back to the /dev/mtdX device
node. If the string does not start with "mtd:", then assume it's the old
style and refers directly to a MTD device node.

The function is then hooked into existing tools like flashcp, mtdinfo,
flash_unlock, etc. To load in the new MTD parsing code in a consistent
way across programs.

[1] http://www.linux-mtd.infradead.org/faq/jffs2.html#L_mtdblock

Signed-off-by: Brandon Maier &lt;brandon.maier@collins.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>misc-utils: flashcp: correct casting for percent display</title>
<updated>2023-04-24T07:01:37+00:00</updated>
<author>
<name>cchoux</name>
<email>chou.cosmo@gmail.com</email>
</author>
<published>2023-04-22T07:31:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a2f6201c501035ec02634b2fa7d261b003ec26bb'/>
<id>urn:sha1:a2f6201c501035ec02634b2fa7d261b003ec26bb</id>
<content type='text'>
Add correct casting for written to prevent overflow that size_t is
only 32 bits on a 32-bit platform.

Signed-off-by: cchoux &lt;chou.cosmo@gmail.com&gt;
Reviewed-by: Zhihao Cheng &lt;chengzhihao1@huawei.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>misc-utils: mtdpart: document partition of size 0</title>
<updated>2022-11-07T07:28:49+00:00</updated>
<author>
<name>Brandon Maier</name>
<email>brandon.maier@collins.com</email>
</author>
<published>2022-11-03T14:12:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=4a84311e4706da5823e20db107809a334708e171'/>
<id>urn:sha1:4a84311e4706da5823e20db107809a334708e171</id>
<content type='text'>
If the partition size passed in to the BLKPG_ADD_PARTITION ioctl is 0,
Linux will make the partition fill to the end of the device[1]. Document
this feature in the help.

[1] https://elixir.bootlin.com/linux/v6.0.6/source/drivers/mtd/mtdpart.c#L254

Signed-off-by: Brandon Maier &lt;brandon.maier@collins.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>misc-utils: flashcp: abort on --partition and --erase-all</title>
<updated>2022-11-07T07:24:45+00:00</updated>
<author>
<name>Brandon Maier</name>
<email>brandon.maier@collins.com</email>
</author>
<published>2022-11-02T22:47:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=5ed8f1b0b72b22754e3025f9c74b37feac6fd720'/>
<id>urn:sha1:5ed8f1b0b72b22754e3025f9c74b37feac6fd720</id>
<content type='text'>
Signed-off-by: Brandon Maier &lt;brandon.maier@collins.com&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
</feed>
