* Re: [PATCH v7 15/18] pstore/blk: Provide way to query pstore configuration
@ 2020-05-10 23:11 kbuild test robot
0 siblings, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2020-05-10 23:11 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 6326 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200510202436.63222-16-keescook@chromium.org>
References: <20200510202436.63222-16-keescook@chromium.org>
TO: Kees Cook <keescook@chromium.org>
Hi Kees,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20200508]
[cannot apply to kees/for-next/pstore ia64/next linus/master v5.7-rc4 v5.7-rc3 v5.7-rc2 v5.7-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kees-Cook/pstore-mtd-support-crash-log-to-block-and-mtd-device/20200511-043555
base: 30e2206e11ce27ae910cc0dab21472429e400a87
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
cppcheck warnings: (new ones prefixed by >>)
>> fs/pstore/zone.c:822:12: warning: Either the condition '!record' is redundant or there is possible null pointer dereference: record. [nullPointerRedundantCheck]
int cnt = record->size;
^
fs/pstore/zone.c:826:15: note: Assuming that condition '!record' is not redundant
if (!zone || !record)
^
fs/pstore/zone.c:822:12: note: Null pointer dereference
int cnt = record->size;
^
fs/pstore/zone.c:824:14: warning: Either the condition '!record' is redundant or there is possible null pointer dereference: record. [nullPointerRedundantCheck]
char *buf = record->buf;
^
fs/pstore/zone.c:826:15: note: Assuming that condition '!record' is not redundant
if (!zone || !record)
^
fs/pstore/zone.c:824:14: note: Null pointer dereference
char *buf = record->buf;
^
fs/pstore/zone.c:995:28: warning: Either the condition '!record' is redundant or there is possible null pointer dereference: record. [nullPointerRedundantCheck]
struct psz_context *cxt = record->psi->data;
^
fs/pstore/zone.c:999:15: note: Assuming that condition '!record' is not redundant
if (!zone || !record)
^
fs/pstore/zone.c:995:28: note: Null pointer dereference
struct psz_context *cxt = record->psi->data;
^
fs/pstore/zone.c:608:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = psz_kmsg_recover(cxt);
^
fs/pstore/zone.c:603:10: note: ret is initialized
int ret = -EBUSY;
^
fs/pstore/zone.c:608:6: note: ret is overwritten
ret = psz_kmsg_recover(cxt);
^
fs/pstore/zone.c:1351:6: warning: Redundant initialization for 'err'. The initialized value is overwritten before it is read. [redundantInitialization]
err = psz_alloc_zones(cxt);
^
fs/pstore/zone.c:1288:10: note: err is initialized
int err = -EINVAL;
^
fs/pstore/zone.c:1351:6: note: err is overwritten
err = psz_alloc_zones(cxt);
^
fs/pstore/blk.c:233:7: warning: Redundant initialization for 'bdev'. The initialized value is overwritten before it is read. [redundantInitialization]
bdev = blkdev_get_by_path(blkdev, mode, holder);
^
fs/pstore/blk.c:218:28: note: bdev is initialized
struct block_device *bdev = ERR_PTR(-ENODEV);
^
fs/pstore/blk.c:233:7: note: bdev is overwritten
bdev = blkdev_get_by_path(blkdev, mode, holder);
^
fs/pstore/blk.c:402:6: warning: Redundant initialization for 'ret'. The initialized value is overwritten before it is read. [redundantInitialization]
ret = psblk_register_do(&dev);
^
fs/pstore/blk.c:364:10: note: ret is initialized
int ret = -ENODEV;
^
fs/pstore/blk.c:402:6: note: ret is overwritten
ret = psblk_register_do(&dev);
^
>> fs/pstore/blk.c:472:20: warning: Unused variable value '_name_' [constStatement]
info->kmsg_size = check_size(kmsg_size, 4096);
^
fs/pstore/blk.c:473:20: warning: Unused variable value '_name_' [constStatement]
info->pmsg_size = check_size(pmsg_size, 4096);
^
fs/pstore/blk.c:474:22: warning: Unused variable value '_name_' [constStatement]
info->ftrace_size = check_size(ftrace_size, 4096);
^
fs/pstore/blk.c:475:23: warning: Unused variable value '_name_' [constStatement]
info->console_size = check_size(console_size, 4096);
^
# https://github.com/0day-ci/linux/commit/2ce3ca24c0ecefdcce529c9295843ab718791f65
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 2ce3ca24c0ecefdcce529c9295843ab718791f65
vim +/_name_ +472 fs/pstore/blk.c
1fe49524a73cc3 WeiXiong Liao 2020-05-10 466
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 467 /* get information of pstore/blk */
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 468 int pstore_blk_get_config(struct pstore_blk_config *info)
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 469 {
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 470 strncpy(info->device, blkdev, 80);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 471 info->max_reason = max_reason;
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 @472 info->kmsg_size = check_size(kmsg_size, 4096);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 473 info->pmsg_size = check_size(pmsg_size, 4096);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 474 info->ftrace_size = check_size(ftrace_size, 4096);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 475 info->console_size = check_size(console_size, 4096);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 476
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 477 return 0;
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 478 }
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 479 EXPORT_SYMBOL_GPL(pstore_blk_get_config);
2ce3ca24c0ecef WeiXiong Liao 2020-05-10 480
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v7 00/18] pstore: mtd: support crash log to block and mtd device
@ 2020-05-10 20:24 Kees Cook
2020-05-10 20:24 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2020-05-10 20:24 UTC (permalink / raw)
To: WeiXiong Liao
Cc: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck,
Jonathan Corbet, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Petr Mladek, Sergey Senozhatsky,
Steven Rostedt, Rob Herring, Pavel Tatashin, linux-doc,
linux-kernel, linux-mtd
Hi!
Well, I guess I spoke too soon. :) Here is v7. Hopefully this is
it. WeiXiong, can you test this and make sure you're happy with the
results?
Take care!
-Kees
v7:
- more renamings in the exported APIs and structs
- fix mtd build
- replace psblk_blkdev_info with passing in a struct to fill
- consolidate bdev opening/checking
- rename psblk_device -> pstore_device_info
- kerndoc for pstore_blk_get_config
- fix hunks in wrong patch
- add missing "static"s for local functions (0day)
v6: https://lore.kernel.org/lkml/20200509234103.46544-1-keescook@chromium.org/
v5: https://lore.kernel.org/lkml/1589022854-19821-1-git-send-email-liaoweixiong@allwinnertech.com/
v4: https://lore.kernel.org/lkml/20200508064004.57898-1-keescook@chromium.org/
v3: https://lore.kernel.org/lkml/1585126506-18635-1-git-send-email-liaoweixiong@allwinnertech.com/
v2: https://lore.kernel.org/lkml/1581078355-19647-1-git-send-email-liaoweixiong@allwinnertech.com/
v1: https://lore.kernel.org/lkml/1579482233-2672-1-git-send-email-liaoweixiong@allwinnertech.com/
Kees Cook (8):
pstore/ram: Move dump_oops to end of module_param list
pstore/platform: Switch pstore_info::name to const
pstore/platform: Move module params after declarations
pstore/platform: Use backend name for console registration
pstore/ram: Refactor ftrace buffer merging
pstore/ftrace: Provide ftrace log merging routine
printk: Introduce kmsg_dump_reason_str()
pstore/blk: Introduce "best_effort" mode
WeiXiong Liao (10):
pstore/zone: Introduce common layer to manage storage zones
pstore/blk: Introduce backend for block devices
pstore/zone,blk: Add support for pmsg frontend
pstore/zone,blk: Add console frontend support
pstore/zone,blk: Add ftrace frontend support
Documentation: Add details for pstore/blk
pstore/zone: Provide way to skip "broken" zone for MTD devices
pstore/blk: Provide way to query pstore configuration
pstore/blk: Support non-block storage devices
mtd: Support kmsg dumper based on pstore/blk
Documentation/admin-guide/pstore-blk.rst | 243 ++++
MAINTAINERS | 1 +
drivers/mtd/Kconfig | 10 +
drivers/mtd/Makefile | 1 +
drivers/mtd/mtdpstore.c | 564 +++++++++
fs/pstore/Kconfig | 109 ++
fs/pstore/Makefile | 6 +
fs/pstore/blk.c | 520 ++++++++
fs/pstore/ftrace.c | 54 +
fs/pstore/internal.h | 9 +
fs/pstore/platform.c | 40 +-
fs/pstore/ram.c | 70 +-
fs/pstore/zone.c | 1463 ++++++++++++++++++++++
include/linux/kmsg_dump.h | 7 +
include/linux/pstore.h | 2 +-
include/linux/pstore_blk.h | 118 ++
include/linux/pstore_zone.h | 60 +
kernel/printk/printk.c | 21 +
18 files changed, 3210 insertions(+), 88 deletions(-)
create mode 100644 Documentation/admin-guide/pstore-blk.rst
create mode 100644 drivers/mtd/mtdpstore.c
create mode 100644 fs/pstore/blk.c
create mode 100644 fs/pstore/zone.c
create mode 100644 include/linux/pstore_blk.h
create mode 100644 include/linux/pstore_zone.h
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v7 15/18] pstore/blk: Provide way to query pstore configuration
2020-05-10 20:24 [PATCH v7 00/18] pstore: mtd: support crash log to block and mtd device Kees Cook
@ 2020-05-10 20:24 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2020-05-10 20:24 UTC (permalink / raw)
To: WeiXiong Liao
Cc: Kees Cook, Anton Vorontsov, Colin Cross, Tony Luck,
Jonathan Corbet, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Petr Mladek, Sergey Senozhatsky,
Steven Rostedt, Rob Herring, Pavel Tatashin, linux-doc,
linux-kernel, linux-mtd
From: WeiXiong Liao <liaoweixiong@allwinnertech.com>
In order to configure itself, the MTD backend needs to be able to query
the current pstore configuration. Introduce pstore_blk_get_config() for
this purpose.
Signed-off-by: WeiXiong Liao <liaoweixiong@allwinnertech.com>
Link: https://lore.kernel.org/r/1585126506-18635-10-git-send-email-liaoweixiong@allwinnertech.com
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/blk.c | 37 ++++++++++++++++++++++++++++++-------
include/linux/pstore_blk.h | 28 ++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index cf11094e6b3a..e8e907ea8b03 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -93,6 +93,17 @@ static struct bdev_info {
sector_t start_sect;
} g_bdev_info;
+#define check_size(name, alignsize) ({ \
+ long _##name_ = (name); \
+ _##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \
+ if (_##name_ & ((alignsize) - 1)) { \
+ pr_info(#name " must align to %d\n", \
+ (alignsize)); \
+ _##name_ = ALIGN(name, (alignsize)); \
+ } \
+ _##name_; \
+})
+
/**
* struct pstore_device_info - back-end pstore/blk driver structure.
*
@@ -148,13 +159,11 @@ static int psblk_register_do(struct pstore_device_info *dev)
dev->flags = UINT_MAX;
#define verify_size(name, alignsize, enabled) { \
- long _##name_ = (enabled) ? (name) : 0; \
- _##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \
- if (_##name_ & ((alignsize) - 1)) { \
- pr_info(#name " must align to %d\n", \
- (alignsize)); \
- _##name_ = ALIGN(name, (alignsize)); \
- } \
+ long _##name_; \
+ if (enabled) \
+ _##name_ = check_size(name, alignsize); \
+ else \
+ _##name_ = 0; \
name = _##name_ / 1024; \
pstore_zone_info->name = _##name_; \
}
@@ -455,6 +464,20 @@ void unregister_pstore_blk(unsigned int major)
}
EXPORT_SYMBOL_GPL(unregister_pstore_blk);
+/* get information of pstore/blk */
+int pstore_blk_get_config(struct pstore_blk_config *info)
+{
+ strncpy(info->device, blkdev, 80);
+ info->max_reason = max_reason;
+ info->kmsg_size = check_size(kmsg_size, 4096);
+ info->pmsg_size = check_size(pmsg_size, 4096);
+ info->ftrace_size = check_size(ftrace_size, 4096);
+ info->console_size = check_size(console_size, 4096);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(pstore_blk_get_config);
+
static void __exit pstore_blk_exit(void)
{
mutex_lock(&pstore_blk_lock);
diff --git a/include/linux/pstore_blk.h b/include/linux/pstore_blk.h
index ccba8c068752..0c40774e71e0 100644
--- a/include/linux/pstore_blk.h
+++ b/include/linux/pstore_blk.h
@@ -49,4 +49,32 @@ struct pstore_blk_info {
int register_pstore_blk(struct pstore_blk_info *info);
void unregister_pstore_blk(unsigned int major);
+/**
+ * struct pstore_blk_config - the pstore_blk backend configuration
+ *
+ * @device: Name of the desired block device
+ * @max_reason: Maximum kmsg dump reason to store to block device
+ * @kmsg_size: Total size of for kmsg dumps
+ * @pmsg_size: Total size of the pmsg storage area
+ * @console_size: Total size of the console storage area
+ * @ftrace_size: Total size for ftrace logging data (for all CPUs)
+ */
+struct pstore_blk_config {
+ char device[80];
+ enum kmsg_dump_reason max_reason;
+ unsigned long kmsg_size;
+ unsigned long pmsg_size;
+ unsigned long console_size;
+ unsigned long ftrace_size;
+};
+
+/**
+ * pstore_blk_get_config - get a copy of the pstore_blk backend configuration
+ *
+ * @info: The sturct pstore_blk_config to be filled in
+ *
+ * Failure returns negative error code, and success returns 0.
+ */
+int pstore_blk_get_config(struct pstore_blk_config *info);
+
#endif
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v7 15/18] pstore/blk: Provide way to query pstore configuration
@ 2020-05-10 20:24 ` Kees Cook
0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2020-05-10 20:24 UTC (permalink / raw)
To: WeiXiong Liao
Cc: Petr Mladek, Tony Luck, Kees Cook, Jonathan Corbet,
Richard Weinberger, Anton Vorontsov, linux-doc, linux-kernel,
Steven Rostedt, Sergey Senozhatsky, Colin Cross, linux-mtd,
Miquel Raynal, Pavel Tatashin, Rob Herring, Vignesh Raghavendra
From: WeiXiong Liao <liaoweixiong@allwinnertech.com>
In order to configure itself, the MTD backend needs to be able to query
the current pstore configuration. Introduce pstore_blk_get_config() for
this purpose.
Signed-off-by: WeiXiong Liao <liaoweixiong@allwinnertech.com>
Link: https://lore.kernel.org/r/1585126506-18635-10-git-send-email-liaoweixiong@allwinnertech.com
Co-developed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
fs/pstore/blk.c | 37 ++++++++++++++++++++++++++++++-------
include/linux/pstore_blk.h | 28 ++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 7 deletions(-)
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index cf11094e6b3a..e8e907ea8b03 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -93,6 +93,17 @@ static struct bdev_info {
sector_t start_sect;
} g_bdev_info;
+#define check_size(name, alignsize) ({ \
+ long _##name_ = (name); \
+ _##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \
+ if (_##name_ & ((alignsize) - 1)) { \
+ pr_info(#name " must align to %d\n", \
+ (alignsize)); \
+ _##name_ = ALIGN(name, (alignsize)); \
+ } \
+ _##name_; \
+})
+
/**
* struct pstore_device_info - back-end pstore/blk driver structure.
*
@@ -148,13 +159,11 @@ static int psblk_register_do(struct pstore_device_info *dev)
dev->flags = UINT_MAX;
#define verify_size(name, alignsize, enabled) { \
- long _##name_ = (enabled) ? (name) : 0; \
- _##name_ = _##name_ <= 0 ? 0 : (_##name_ * 1024); \
- if (_##name_ & ((alignsize) - 1)) { \
- pr_info(#name " must align to %d\n", \
- (alignsize)); \
- _##name_ = ALIGN(name, (alignsize)); \
- } \
+ long _##name_; \
+ if (enabled) \
+ _##name_ = check_size(name, alignsize); \
+ else \
+ _##name_ = 0; \
name = _##name_ / 1024; \
pstore_zone_info->name = _##name_; \
}
@@ -455,6 +464,20 @@ void unregister_pstore_blk(unsigned int major)
}
EXPORT_SYMBOL_GPL(unregister_pstore_blk);
+/* get information of pstore/blk */
+int pstore_blk_get_config(struct pstore_blk_config *info)
+{
+ strncpy(info->device, blkdev, 80);
+ info->max_reason = max_reason;
+ info->kmsg_size = check_size(kmsg_size, 4096);
+ info->pmsg_size = check_size(pmsg_size, 4096);
+ info->ftrace_size = check_size(ftrace_size, 4096);
+ info->console_size = check_size(console_size, 4096);
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(pstore_blk_get_config);
+
static void __exit pstore_blk_exit(void)
{
mutex_lock(&pstore_blk_lock);
diff --git a/include/linux/pstore_blk.h b/include/linux/pstore_blk.h
index ccba8c068752..0c40774e71e0 100644
--- a/include/linux/pstore_blk.h
+++ b/include/linux/pstore_blk.h
@@ -49,4 +49,32 @@ struct pstore_blk_info {
int register_pstore_blk(struct pstore_blk_info *info);
void unregister_pstore_blk(unsigned int major);
+/**
+ * struct pstore_blk_config - the pstore_blk backend configuration
+ *
+ * @device: Name of the desired block device
+ * @max_reason: Maximum kmsg dump reason to store to block device
+ * @kmsg_size: Total size of for kmsg dumps
+ * @pmsg_size: Total size of the pmsg storage area
+ * @console_size: Total size of the console storage area
+ * @ftrace_size: Total size for ftrace logging data (for all CPUs)
+ */
+struct pstore_blk_config {
+ char device[80];
+ enum kmsg_dump_reason max_reason;
+ unsigned long kmsg_size;
+ unsigned long pmsg_size;
+ unsigned long console_size;
+ unsigned long ftrace_size;
+};
+
+/**
+ * pstore_blk_get_config - get a copy of the pstore_blk backend configuration
+ *
+ * @info: The sturct pstore_blk_config to be filled in
+ *
+ * Failure returns negative error code, and success returns 0.
+ */
+int pstore_blk_get_config(struct pstore_blk_config *info);
+
#endif
--
2.20.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-05-10 23:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-10 23:11 [PATCH v7 15/18] pstore/blk: Provide way to query pstore configuration kbuild test robot
-- strict thread matches above, loose matches on Subject: below --
2020-05-10 20:24 [PATCH v7 00/18] pstore: mtd: support crash log to block and mtd device Kees Cook
2020-05-10 20:24 ` [PATCH v7 15/18] pstore/blk: Provide way to query pstore configuration Kees Cook
2020-05-10 20:24 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.