<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mtd-utils.git/ubi-utils/mtdinfo.c, branch v2.3.1</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.1</id>
<link rel='self' href='https://git.infraroot.at/mtd-utils.git/atom?h=v2.3.1'/>
<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>ubi-utils: mtdinfo: Fix type truncation compiling warning for 'start' variable</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:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=53a16db8824ee93ab066e57744cb6f7ea5ba053d'/>
<id>urn:sha1:53a16db8824ee93ab066e57744cb6f7ea5ba053d</id>
<content type='text'>
Fix following compiling warning by using the right format:
 ubi-utils/mtdinfo.c:207:21: warning: format ‘%lx’ expects argument of
 type ‘long unsigned int’, but argument 4 has type ‘long long unsigned
 int’

Fixes: 78f4f38bd3de8 ("ubi-utils: Fix integer overflow in mtdinfo.c")
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>ubi-utils: Fix integer overflow in mtdinfo.c</title>
<updated>2024-12-17T13:34:24+00:00</updated>
<author>
<name>Anton Moryakov</name>
<email>ant.v.moryakov@gmail.com</email>
</author>
<published>2024-12-14T12:31:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=78f4f38bd3de8b5c590cbc09ce43812306207d95'/>
<id>urn:sha1:78f4f38bd3de8b5c590cbc09ce43812306207d95</id>
<content type='text'>
Report of the static analyzer:
The value of an arithmetic expression 'reginfo-&gt;offset + i * reginfo-&gt;erasesize' is a subject to overflow
because its operands are not cast to a larger data type before performing arithmetic

Corrections explained:
Added casting i and start to unsigned long long

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>Make sure ubi-media structures are visible for libubigen</title>
<updated>2023-08-24T08:02:59+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2023-08-24T08:02:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=dfae7f60dfb577031175848b0dbf5d12ff1ebbc3'/>
<id>urn:sha1:dfae7f60dfb577031175848b0dbf5d12ff1ebbc3</id>
<content type='text'>
The libubigen.h header relies on external declarations in ubi-media.h.
While not technically needed, it generates warnings in mtdinfo.c if
those are not visible. All other places where libubigen is used include
the header first. This is primarily to silence compiler warnings related
to the missing declrations.

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>Fix typos found by Debian's lintian tool</title>
<updated>2020-09-11T13:40:54+00:00</updated>
<author>
<name>Bastian Germann</name>
<email>bastiangermann@fishpost.de</email>
</author>
<published>2020-09-08T20:07:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=763a4b3a17e3fb4ab67c6105e06df891e60471bc'/>
<id>urn:sha1:763a4b3a17e3fb4ab67c6105e06df891e60471bc</id>
<content type='text'>
Signed-off-by: Bastian Germann &lt;bastiangermann@fishpost.de&gt;
Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Fix libmtd behaviour if MTD is not present on the system</title>
<updated>2017-03-15T11:10:34+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2017-03-15T10:26:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63'/>
<id>urn:sha1:a2eeedb0a7af1d8ebe8593cb9a9bb994d2854e63</id>
<content type='text'>
The documentation of libmtd_open says, if it returns NULL and errno is
zero, MTD is not present. However, the current version always returns
a libmtd_t object. The function internally checks, if it can access the
MTD sysfs files and, if not, sets a flag to use the procfs fallback.

This patch adds an additional check to libmtd_open, to test if the
MTD procfs file can be read and fails with errno cleared if it does
not exist.

Furhtermore, mtd_get_info is documented to fail with errno set to ENODEV
if MTD is not present. First of all, this was broken in the original
version. It was implemented to specification for the sysfs code path,
but if MTD is not present, that won't be executed, because of the flag
set by libmtd_open. This makes the check not only redundant, but masks
an actual error (the sysfs paths suddenly not being readable anymore).
The legacy path that was used if the sysfs files are not avaible fails
with ENOENT if it cannot read the procfs file. With the above changes
in addition, we don't have a libmtd_t object if neither sysfs nor
procfs is readable, so this error status no longer makes sense.

This patch removes the documentation on the ENODEV errno, and
makes sure that mtd_get_info always returns with apropriate errno
on failure.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>Merge rest of ubiutils-common into libmtd common</title>
<updated>2016-11-17T10:36:56+00:00</updated>
<author>
<name>David Oberhollenzer</name>
<email>david.oberhollenzer@sigma-star.at</email>
</author>
<published>2016-09-01T13:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=f4ec4511d0729802e783b1757d6bcd556737510e'/>
<id>urn:sha1:f4ec4511d0729802e783b1757d6bcd556737510e</id>
<content type='text'>
This patch moves the remaining 3 functions from ubiutils-common.{c,h}
into libmtd common.{c,h}.

The functions are only generic utility functions that other mtd-utils
programs may also find usefull and every program that uses libubi links
against libmtd anyway so there is no real reason for keeping around a
seperate ubiutils-common with only generic helper functions.

Signed-off-by: David Oberhollenzer &lt;david.oberhollenzer@sigma-star.at&gt;
</content>
</entry>
<entry>
<title>libmtd: don't ignore "region index" parameter in mtd_regioninfo()</title>
<updated>2014-11-05T03:00:42+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2014-09-15T17:35:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=6eb466a4f34808d29e3a704f6cabc7f70beebdc8'/>
<id>urn:sha1:6eb466a4f34808d29e3a704f6cabc7f70beebdc8</id>
<content type='text'>
ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three
output parameters (info about the erase region). There are two problems
in mtdinfo/libmtd here:

 1. mtdinfo.c doesn't initialize its region_info_user struct, instead
    passing uninitialized data to mtd_regioninfo()

 2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out
    the regionindex parameter properly, so the garbage from mtdinfo.c is
    propagated to the ioctl()

This means that mtdinfo will continuously probe the same (possibly
out-of-range) erase region, instead of looping over the valid regions.

Let's fix this in the mtd_regioninfo() helper, and at the same time,
let's zero out the mtdinfo.c buffer, as an additional precaution to keep
from using uninitialized data.

Initial error report from Yang, when running "mtdinfo /dev/mtd0" on a
Cavium 6100 board:

	root@CN61XX:~# mtdinfo /dev/mtd0
	mtd0
	Name:                           phys_mapped_flash
	Type:                           nor
	Eraseblock size:                65536 bytes, 64.0 KiB
	Amount of eraseblocks:          128 (8388608 bytes, 8.0 MiB)
	Minimum input/output unit size: 1 byte
	Sub-page size:                  1 byte
	Additional erase regions:       0
	Character device major/minor:   90:0
	Bad blocks are allowed:         false
	Device is writable:             true
	libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 0
	        error 22 (Invalid argument)
	Eraseblock region 0:  info is unavailable
	libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 1
	        error 22 (Invalid argument)
	Eraseblock region 1:  info is unavailable

Reported-by: Yang Wei &lt;Wei.Yang@windriver.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>check the MLC nand type</title>
<updated>2013-10-22T23:19:23+00:00</updated>
<author>
<name>Huang Shijie</name>
<email>b32955@freescale.com</email>
</author>
<published>2013-08-20T05:58:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=263e138719f6358c3cf2ce47d6254cebef31dd4b'/>
<id>urn:sha1:263e138719f6358c3cf2ce47d6254cebef31dd4b</id>
<content type='text'>
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC.

In the kernel, the MTD_NANDFLASH only stands for the SLC now,
so in order to keep the logic unchanged, we should also check the MLC
NAND by MTD_MLCNANDFLASH.

Signed-off-by: Huang Shijie &lt;b32955@freescale.com&gt;
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
</content>
</entry>
<entry>
<title>mtdinfo: correct grammar on error message</title>
<updated>2012-02-14T09:00:13+00:00</updated>
<author>
<name>Brian Norris</name>
<email>computersforpeace@gmail.com</email>
</author>
<published>2012-02-09T18:13:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.infraroot.at/mtd-utils.git/commit/?id=b989a29c2c1159867e03356d49a2903431899159'/>
<id>urn:sha1:b989a29c2c1159867e03356d49a2903431899159</id>
<content type='text'>
Signed-off-by: Brian Norris &lt;computersforpeace@gmail.com&gt;
Signed-off-by: Artem Bityutskiy &lt;artem.bityutskiy@linux.intel.com&gt;
</content>
</entry>
</feed>
