Commit Graph

10 Commits (c382237ac33a787043b22abc42f0c5a80278baae)

Author SHA1 Message Date
Zhai Zhaoxuan c382237ac3 packages: nvram: fix memory leak in _nvram_free
The value of nvram_tuple_t is allocated in _nvram_realloc,
but it is not freed in _nvram_free.

Signed-off-by: Zhai Zhaoxuan <zhaizhaoxuan@xiaomi.com>
7 years ago
BangLang Huang 1948d8e08c nvram: fix memory leak
Fix memory leak on nvram_open() and nvram_open_rdonly().

For nvram_open(), the 'fd' should be closed on error, and
mmap_area should be unmap when nvram magic can not be found.

For nvram_open_rdonly(), the 'file' variable should free before
return. Once nvram_find_mtd() return successfully, it will allocate
memory to save mtd device string.

Signed-off-by: BangLang Huang <banglang.huang@foxmail.com>
7 years ago
Rafał Miłecki 4497c35bd0 nvram: get rid of NVRAM_SPACE
Now we support NVRAM whatever its size is.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46262
9 years ago
Rafał Miłecki 9f15849910 nvram: fix "Segmentation fault" caused by setting memory out of buffer
Some MTD partitions with NVRAM have content starting in the middle. In
such case offset is set and nvram_header returns pointer to the middle.
It means we have to respect offset when calculating remaining space.

By the way use real MTD partition size (nvram_part_size variable) as we
may want to bump NVRAM_SPACE in the (very near) future.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 46251
9 years ago
Rafał Miłecki 97a0e165a6 nvram: fix regression in finding NVRAM beginning
The loop was giving up too early as it never expected NVRAM smaller
than 0x10000.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45578
9 years ago
Rafał Miłecki 3931288caa nvram: refuse to open NVRAM for writing if it's too big to be handled
Otherwise writing anything will result in loosing data.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45565
9 years ago
Rafał Miłecki d94fb398f6 nvram: drop check for WGT634U using /proc/diag/model
We don't have broadcom-diag for months or years now and the correct
solution is to simply don't have "nvram" partition on WGT634U anyway.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45564
9 years ago
Rafał Miłecki 0c4c05f0e7 nvram: use correct variable name for MTD partition size
Sytax of /proc/mtd is following:
dev:    size   erasesize  name
which means that sscanf "mtd%d: %08x" reads size, not erasesize.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45563
9 years ago
Rafał Miłecki 615fef1ab8 nvram: drop support for ancient /dev/mtdblock/%d
Path /dev/mtdblock%d is used for years now.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>

SVN-Revision: 45562
9 years ago
John Crispin 4ebf19b48f packages: clean up the package folder
Signed-off-by: John Crispin <blogic@openwrt.org>

SVN-Revision: 37007
11 years ago