From: Leon Romanovsky <[email protected]>

Once GCOV fails to duplicate information, the following error is
printed:
 gcov: could not save data for 
'/home/leonro/src/kernel/drivers/infiniband/hw/mlx5/std_types.gcda' (out of 
memory)

In the event of out-of-memory such prints are seen for almost every kernel
file, so instead of spamming dmesg, we print the first failure and inform
the user that future prints are suppressed.

Cc: Colin Ian King <[email protected]>
Signed-off-by: Leon Romanovsky <[email protected]>
---
 kernel/gcov/fs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/gcov/fs.c b/kernel/gcov/fs.c
index 82babf5aa077..b74d426ca99e 100644
--- a/kernel/gcov/fs.c
+++ b/kernel/gcov/fs.c
@@ -685,8 +685,9 @@ static void save_info(struct gcov_node *node, struct 
gcov_info *info)
        else {
                node->unloaded_info = gcov_info_dup(info);
                if (!node->unloaded_info) {
-                       pr_warn("could not save data for '%s' "
-                               "(out of memory)\n",
+                       pr_warn_once(
+                               "could not save data for first file '%s' "
+                               "(out of memory), other files are suppressed\n",
                                gcov_info_filename(info));
                }
        }
--
2.26.2

Reply via email to