Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package ppc64-diag for openSUSE:Factory 
checked in at 2022-09-15 23:00:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ppc64-diag (Old)
 and      /work/SRC/openSUSE:Factory/.ppc64-diag.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ppc64-diag"

Thu Sep 15 23:00:12 2022 rev:47 rq:1003936 version:2.7.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/ppc64-diag/ppc64-diag.changes    2021-07-16 
00:03:21.520284503 +0200
+++ /work/SRC/openSUSE:Factory/.ppc64-diag.new.2083/ppc64-diag.changes  
2022-09-15 23:01:29.313604704 +0200
@@ -1,0 +2,8 @@
+Thu Sep 15 16:30:04 UTC 2022 - Michal Suchanek <msucha...@suse.com>
+
+- Update to version 2.7.8 (jsc#PED-536)
+- Remove upstreamed patch
+  - ppc64-diag-Directories-should-be-created-executable.patch
+- Use new libvpd
+
+-------------------------------------------------------------------

Old:
----
  ppc64-diag-2.7.7.tar.gz
  ppc64-diag-Directories-should-be-created-executable.patch

New:
----
  ppc64-diag-2.7.8.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ppc64-diag.spec ++++++
--- /var/tmp/diff_new_pack.vDYpRX/_old  2022-09-15 23:01:29.753605947 +0200
+++ /var/tmp/diff_new_pack.vDYpRX/_new  2022-09-15 23:01:29.757605958 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package ppc64-diag
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           ppc64-diag
-Version:        2.7.7
+Version:        2.7.8
 Release:        0
 Summary:        Linux for Power Platform Diagnostics
 License:        GPL-2.0-or-later
@@ -26,8 +26,6 @@
 Source0:        
https://github.com/power-ras/ppc64-diag/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
 #PATCH-FIX-OPENSUSE - ppc64-diag.varunused.patch - fix unused variables
 Patch1:         ppc64-diag.varunused.patch
-#PATCH-FIX-OPENSUSE - ppc64-diag.varunused.patch - fix unused variables
-Patch2:         ppc64-diag-Directories-should-be-created-executable.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  bison
@@ -37,11 +35,11 @@
 BuildRequires:  librtas-devel >= 1.4.0
 BuildRequires:  libservicelog-devel
 BuildRequires:  libtool
+BuildRequires:  libvpd-devel
 BuildRequires:  perl
 BuildRequires:  pkgconfig
 BuildRequires:  systemd-rpm-macros
 BuildRequires:  pkgconfig(libudev)
-BuildRequires:  pkgconfig(libvpd-2)
 BuildRequires:  pkgconfig(ncurses)
 BuildRequires:  pkgconfig(sqlite3)
 Requires:       cron

++++++ ppc64-diag-2.7.7.tar.gz -> ppc64-diag-2.7.8.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/configure.ac 
new/ppc64-diag-2.7.8/configure.ac
--- old/ppc64-diag-2.7.7/configure.ac   2021-04-30 10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/configure.ac   2022-03-03 16:38:04.000000000 +0100
@@ -1,9 +1,9 @@
 #                                               -*- Autoconf -*-
 # Process this file with autoconf to produce a configure script.
-m4_define([ppc64_diag_version], 2.7.7)
+m4_define([ppc64_diag_version], 2.7.8)
 
 AC_PREREQ([2.69])
-AC_INIT([ppc64-diag], ppc64_diag_version, [hegdevas...@linux.ibm.com, 
sb...@linux.ibm.com])
+AC_INIT([ppc64-diag], ppc64_diag_version, [mah...@linux.ibm.com, 
s...@linux.ibm.com])
 AC_CONFIG_AUX_DIR([config])
 AC_CONFIG_MACRO_DIR([m4])
 AC_SUBST(DATE, [`date`])
@@ -98,6 +98,12 @@
        [],
        [AC_MSG_FAILURE([libvpd header files required (use --without-librtas to 
disable)])]
        )]
+
+       # libvpd >= 2.2.9 check
+       [PKG_CHECK_MODULES([LIBVPD], [libvpd_cxx-2 >= 2.2.9],
+       [],
+       [AC_MSG_FAILURE([VPD library(libvpd) version 2.2.9 is required for 
lsvpd)])]
+       )]
 )
 
 AM_CONDITIONAL([WITH_LIBRTAS], [test "x$with_librtas" = "xyes"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/diags/bluehawk.c 
new/ppc64-diag-2.7.8/diags/bluehawk.c
--- old/ppc64-diag-2.7.7/diags/bluehawk.c       2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/diags/bluehawk.c       2022-03-03 16:38:04.000000000 
+0100
@@ -559,14 +559,16 @@
 
        printf("\n  Power Supply Status\n");
        for (i = 0; i < 2; i++) {
+               struct voltage_sensor_status p, q;
+
+               memcpy(&p, &(dp->voltage_sensor_sets[i].sensor_12V), sizeof(p));
+               memcpy(&q, &(dp->voltage_sensor_sets[i].sensor_3_3VA), 
sizeof(q));
                printf("    %s:  ", power_supply_names[i]);
                print_power_supply_status(&(dp->ps_status[i]));
                printf("      12V:  ");
-               print_voltage_sensor_status(
-                               &(dp->voltage_sensor_sets[i].sensor_12V));
+               print_voltage_sensor_status(&p);
                printf("      3.3VA:  ");
-               print_voltage_sensor_status(
-                               &(dp->voltage_sensor_sets[i].sensor_3_3VA));
+               print_voltage_sensor_status(&q);
        }
 
        printf("\n  Fan Status\n");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/diags/diag_disk.c 
new/ppc64-diag-2.7.8/diags/diag_disk.c
--- old/ppc64-diag-2.7.7/diags/diag_disk.c      2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/diags/diag_disk.c      2022-03-03 16:38:04.000000000 
+0100
@@ -188,8 +188,13 @@
        }
 
 
-       snprintf(filename, sizeof(filename) - 1, "%s/%s",
-                DISK_OUTPUT_PATH, xml_filename);
+       rc = snprintf(filename, sizeof(filename) - 1, "%s/%s",
+                       DISK_OUTPUT_PATH, xml_filename);
+       if (rc < 0 || (rc >= sizeof(filename) - 1)) {
+               fprintf(stderr, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, xml_filename);
+               return -1;
+       }
 
        result_file = fopen(filename, "w");
        if (!result_file)
@@ -258,7 +263,8 @@
         */
        if (strlen(serial) > 5)
                start_index = strlen(serial) - 5;
-       strncpy(machine_serial, serial + start_index, SERIAL_NUM_LEN);
+       memcpy(machine_serial, serial + start_index, SERIAL_NUM_LEN);
+       machine_serial[SERIAL_NUM_LEN - 1] = '\0';
 
        device_fd = open(DEVICE_TREE_MODEL, O_RDONLY);
        if (device_fd < 0)
@@ -274,7 +280,8 @@
        if (strchr(model, ',') != NULL)
                temp = strchr(model, ',') + 1;
 
-       strncpy(machine_type, temp, MACHINE_MODEL_LEN + 1);
+       memcpy(machine_type, temp, MACHINE_MODEL_LEN + 1);
+       machine_type[MACHINE_MODEL_LEN] = '\0';
        *machine_model = strchr(machine_type, '-');
        if (*machine_model == NULL) /* Failed to get model name */
                return -1;
@@ -391,6 +398,7 @@
        DIR *d;
        struct dirent *namelist;
        char filename[PATH_MAX];
+       int rc;
 
        d = opendir(DISK_OUTPUT_PATH);
        if (!d)
@@ -400,8 +408,14 @@
                if (namelist->d_name[0] == '.')
                        continue;
 
-               snprintf(filename, sizeof(filename) - 1, "%s/%s",
+               rc = snprintf(filename, sizeof(filename) - 1, "%s/%s",
                                DISK_OUTPUT_PATH, namelist->d_name);
+               if (rc < 0 || rc >= (sizeof(filename) - 1)) {
+                       fprintf(stderr, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, namelist->d_name);
+                       continue;
+               }
+
                if (unlink(filename) < 0) {
                        fprintf(stderr,
                        "\nUnable to remove old log file[%s]. continuing.\n\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/diags/diag_encl.c 
new/ppc64-diag-2.7.8/diags/diag_encl.c
--- old/ppc64-diag-2.7.7/diags/diag_encl.c      2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/diags/diag_encl.c      2022-03-03 16:38:04.000000000 
+0100
@@ -158,8 +158,8 @@
                return;
 
        memset(cmd_opts.prev_path, 0, path_len);
-       strncpy(cmd_opts.prev_path, DIAG_ENCL_PREV_PAGES_DIR,
-               strlen(DIAG_ENCL_PREV_PAGES_DIR));
+       if (strlen(DIAG_ENCL_PREV_PAGES_DIR) < path_len)
+               strcpy(cmd_opts.prev_path, DIAG_ENCL_PREV_PAGES_DIR);
 
        path_len -= strlen(DIAG_ENCL_PREV_PAGES_DIR);
        strncat(cmd_opts.prev_path, encl_loc, path_len - 1);
@@ -403,8 +403,13 @@
                            !strcmp(edirent->d_name, ".."))
                                continue;
 
-                       snprintf(path, PATH_MAX, "%s/%s/device/scsi_generic",
-                                SCSI_SES_PATH, edirent->d_name);
+                       rc = snprintf(path, PATH_MAX, 
"%s/%s/device/scsi_generic",
+                                       SCSI_SES_PATH, edirent->d_name);
+                       if (rc <  0 || rc >= PATH_MAX) {
+                               fprintf(stderr, "%s:%d - Unable to format %s\n",
+                                               __func__, __LINE__, 
edirent->d_name);
+                               continue;
+                       }
 
                        sdir = opendir(path);
                        if (!sdir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/diags/encl_util.c 
new/ppc64-diag-2.7.8/diags/encl_util.c
--- old/ppc64-diag-2.7.7/diags/encl_util.c      2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/diags/encl_util.c      2022-03-03 16:38:04.000000000 
+0100
@@ -473,6 +473,7 @@
        struct dirent *edirent, *sdirent;
        DIR *edir, *sdir;
        char path[PATH_MAX];
+       int rc;
 
        edir = opendir(SCSI_SES_PATH);
        if (!edir) {
@@ -486,8 +487,13 @@
                    !strcmp(edirent->d_name, ".."))
                        continue;
 
-               snprintf(path, PATH_MAX, "%s/%s/device/scsi_generic",
-                        SCSI_SES_PATH, edirent->d_name);
+               rc = snprintf(path, PATH_MAX, "%s/%s/device/scsi_generic",
+                               SCSI_SES_PATH, edirent->d_name);
+               if (rc < 0 || rc >= PATH_MAX) {
+                       fprintf(stderr, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, edirent->d_name);
+                       continue;
+               }
 
                sdir = opendir(path);
                if (!sdir)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/ela/Makefile.am 
new/ppc64-diag-2.7.8/ela/Makefile.am
--- old/ppc64-diag-2.7.7/ela/Makefile.am        2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/ela/Makefile.am        2022-03-03 16:38:04.000000000 
+0100
@@ -62,7 +62,7 @@
 CLEAN_LOCALS += clean-local-ela
 
 install-exec-hook-ela:
-       install -d --mode=655 
$(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/
+       install -d --mode=755 
$(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/
        install -D --mode=644 $(CATALOG) 
$(DESTDIR)/etc/ppc64-diag/message_catalog/
        install -D --mode=644 $(CATALOG_REGEX) \
                $(DESTDIR)/etc/ppc64-diag/message_catalog/with_regex/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/lpd/indicator_marvell.c 
new/ppc64-diag-2.7.8/lpd/indicator_marvell.c
--- old/ppc64-diag-2.7.7/lpd/indicator_marvell.c        2021-04-30 
10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/lpd/indicator_marvell.c        2022-03-03 
16:38:04.000000000 +0100
@@ -391,7 +391,13 @@
        list_new->type = TYPE_MARVELL;
        strncpy(list_new->code, vpd->location, LOCATION_LENGTH);  /* loc. code 
*/
        strncpy(list_new->devname, vpd->dev, DEV_LENGTH);   /* sdX device name 
*/
-       snprintf(list_new->dev, DEV_LENGTH, "%s/resource5", path); /* PCI BAR5 
*/
+       /* PCI BAR5 */
+       len = snprintf(list_new->dev, DEV_LENGTH, "%s/resource5", path);
+       if (len < 0 || len >= DEV_LENGTH) {
+               log_msg("'%s':'%d' - Unable to format '%s'", __func__, 
__LINE__, path);
+               return -1;
+       }
+
        list_new->index = (uint32_t)atoi(&ata_device[3]); /* use for ATA index 
*/
 
        dbg("Marvell HDD LED:");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/lpd/indicator_ses.c 
new/ppc64-diag-2.7.8/lpd/indicator_ses.c
--- old/ppc64-diag-2.7.7/lpd/indicator_ses.c    2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/lpd/indicator_ses.c    2022-03-03 16:38:04.000000000 
+0100
@@ -298,6 +298,7 @@
 
                /* fill loc_code structure */
                strncpy(curr->code, vpd->location, LOCATION_LENGTH -1);
+               curr->code[LOCATION_LENGTH - 1] = '\0';
                if (strcmp(fru_loc, "-")) {     /* Components */
                        strncat(curr->code, "-",
                                LOCATION_LENGTH - strlen(curr->code) - 1);
@@ -309,6 +310,7 @@
 
                /* We need to keep track of the sg device. */
                strncpy(curr->dev, vpd->dev, DEV_LENGTH - 1);
+               curr->dev[DEV_LENGTH - 1] = '\0';
 
                /* lsvpd does not provide vpd data for components like power
                 * supply inside enclosure. Lets keep the display name.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/lpd/lp_diag.c 
new/ppc64-diag-2.7.8/lpd/lp_diag.c
--- old/ppc64-diag-2.7.7/lpd/lp_diag.c  2021-04-30 10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/lpd/lp_diag.c  2022-03-03 16:38:04.000000000 +0100
@@ -300,6 +300,7 @@
                        }
 
                        strncpy(fru->location, location, LOCATION_LENGTH - 1);
+                       fru->location[LOCATION_LENGTH - 1] = '\0';
                }
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/opal-dump-parse/opal-dump-parse.c 
new/ppc64-diag-2.7.8/opal-dump-parse/opal-dump-parse.c
--- old/ppc64-diag-2.7.7/opal-dump-parse/opal-dump-parse.c      2021-04-30 
10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/opal-dump-parse/opal-dump-parse.c      2022-03-03 
16:38:04.000000000 +0100
@@ -202,7 +202,8 @@
                dump_suffix[DUMP_FILE_SUFFIX_SIZE] = '\0';
                if ((sz + strlen(dump_suffix)) >= PATH_MAX)
                        return rc;
-               strncat(dump_path, dump_suffix, strlen(dump_suffix));
+               strncat(dump_path, dump_suffix,
+                               PATH_MAX - (strlen(dump_path)));
        }
 
        fd = open(dump_path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/opal_errd/extract_opal_dump.c 
new/ppc64-diag-2.7.8/opal_errd/extract_opal_dump.c
--- old/ppc64-diag-2.7.7/opal_errd/extract_opal_dump.c  2021-04-30 
10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/opal_errd/extract_opal_dump.c  2022-03-03 
16:38:04.000000000 +0100
@@ -34,6 +34,8 @@
 #include <dirent.h>
 #include <endian.h>
 #include <syslog.h>
+#include <libgen.h>
+#include "platform.c"
 
 #define DEFAULT_SYSFS_PATH     "/sys"
 #define DEFAULT_DUMP_PATH      "firmware/opal/dump"
@@ -89,7 +91,12 @@
        int fd;
        int rc;
 
-       snprintf(ack_file, sizeof(ack_file), "%s/acknowledge", dump_dir_path);
+       rc = snprintf(ack_file, sizeof(ack_file), "%s/acknowledge", 
dump_dir_path);
+       if (rc < 0 || rc >= sizeof(ack_file)) {
+               syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, dump_dir_path);
+               return;
+       }
 
        fd = open(ack_file, O_WRONLY);
 
@@ -142,11 +149,21 @@
        char dump_path2[PATH_MAX];
        int rc;
 
-       snprintf(dump_path1, PATH_MAX, "%s/%s",
-                opt_output_dir, (*file1)->d_name);
+       rc = snprintf(dump_path1, PATH_MAX, "%s/%s",
+                       opt_output_dir, (*file1)->d_name);
+       if (rc < 0 || rc >= PATH_MAX) {
+               syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, (*file1)->d_name);
+               return -1;
+       }
 
-       snprintf(dump_path2, PATH_MAX, "%s/%s",
-                opt_output_dir, (*file2)->d_name);
+       rc = snprintf(dump_path2, PATH_MAX, "%s/%s",
+                       opt_output_dir, (*file2)->d_name);
+       if (rc < 0 || rc >= PATH_MAX) {
+               syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, (*file2)->d_name);
+               return -1;
+       }
 
        rc = stat(dump_path1, &sbuf1);
        if (rc < 0)
@@ -176,6 +193,7 @@
        int i;
        int n;
        int count = 0;
+       int rc;
 
        check_dup_dump_file(dumpname);
 
@@ -194,8 +212,14 @@
                }
 
                count++;
-               snprintf(dump_path, PATH_MAX, "%s/%s",
-                        opt_output_dir, dirent->d_name);
+               rc = snprintf(dump_path, PATH_MAX, "%s/%s",
+                               opt_output_dir, dirent->d_name);
+               if (rc < 0 || rc >= PATH_MAX) {
+                       syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, dirent->d_name);
+                       free(namelist[i]);
+                       continue;
+               }
 
                free(namelist[i]);
 
@@ -229,7 +253,12 @@
        uint16_t prefix_size;
        int rc;
 
-       snprintf(dump_path, sizeof(dump_path), "%s/dump", dump_dir_path);
+       rc = snprintf(dump_path, sizeof(dump_path), "%s/dump", dump_dir_path);
+       if (rc < 0 || rc >= sizeof(dump_path)) {
+               syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, dump_dir_path);
+               return -1;
+       }
 
        if (stat(dump_path,&sbuf) == -1)
                return -1;
@@ -354,8 +383,14 @@
                        continue;
                }
 
-               snprintf(dump_path, sizeof(dump_path), "%s/%s",
-                        opal_dump_dir, dirent->d_name);
+               rc = snprintf(dump_path, sizeof(dump_path), "%s/%s",
+                               opal_dump_dir, dirent->d_name);
+               if (rc < 0 || rc >= sizeof(dump_path)) {
+                       syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, dirent->d_name);
+                       free(namelist[i]);
+                       continue;
+               }
 
                is_dir = 0;
 
@@ -398,8 +433,16 @@
        char sysfs_path[PATH_MAX];
        int rc;
        int fd;
+       int platform = 0;
        fd_set exceptfds;
 
+       platform = get_platform();
+       if (platform != PLATFORM_POWERNV) {
+               fprintf(stderr, "%s is not supported on the %s platform\n",
+                               basename(argv[0]), 
__power_platform_name(platform));
+               exit(0);
+       }
+
        setlogmask(LOG_UPTO(LOG_NOTICE));
        openlog("OPAL_DUMP", LOG_CONS | LOG_PID | LOG_NDELAY | LOG_PERROR,
                LOG_LOCAL1);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ppc64-diag-2.7.7/opal_errd/opal-elog-parse/opal-elog-parse.c 
new/ppc64-diag-2.7.8/opal_errd/opal-elog-parse/opal-elog-parse.c
--- old/ppc64-diag-2.7.7/opal_errd/opal-elog-parse/opal-elog-parse.c    
2021-04-30 10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/opal_errd/opal-elog-parse/opal-elog-parse.c    
2022-03-03 16:38:04.000000000 +0100
@@ -59,6 +59,7 @@
 
 static int file_filter(const struct dirent *d)
 {
+       int rc;
        struct stat sbuf;
        char filename[PATH_MAX];
 
@@ -67,7 +68,13 @@
        if (d->d_type == DT_REG)
                return 1;
 
-       snprintf(filename, PATH_MAX, "%s/%s", opt_platform_dir, d->d_name);
+       rc = snprintf(filename, PATH_MAX, "%s/%s", opt_platform_dir, d->d_name);
+       if (rc < 0 || rc >= PATH_MAX) {
+               fprintf(stderr, "%s:%d - Unable to format %s\n",
+                               __func__, __LINE__, d->d_name);
+               return 0;
+       }
+
        if (stat(filename, &sbuf))
                return 0;
        if (S_ISREG(sbuf.st_mode))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/opal_errd/opal_errd.c 
new/ppc64-diag-2.7.8/opal_errd/opal_errd.c
--- old/ppc64-diag-2.7.7/opal_errd/opal_errd.c  2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/opal_errd/opal_errd.c  2022-03-03 16:38:04.000000000 
+0100
@@ -309,6 +309,7 @@
        char *out_dir = NULL;
        struct dirent **namelist;
        struct dirent *dirent;
+       int rc;
 
        n = scandir(output_dir, &namelist, is_suffixless_elog_filename, 
alphasort);
        if (n < 0)
@@ -321,8 +322,14 @@
                        continue;
                }
 
-               snprintf(oldname, sizeof(oldname), "%s/%s",
-                        output_dir, dirent->d_name);
+               rc = snprintf(oldname, sizeof(oldname), "%s/%s",
+                               output_dir, dirent->d_name);
+               if (rc < 0 || rc >= sizeof(oldname)) {
+                       syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, dirent->d_name);
+                       free(namelist[i]);
+                       continue;
+               }
 
                elog_type = get_elog_type_from_file_data(oldname);
                if (elog_type == OPAL_ELOG_INVALID) {
@@ -330,8 +337,14 @@
                        continue; /* Delete the file here ? */
                }
 
-               snprintf(newname, sizeof(newname), "%s-%s",
-                        oldname, ELOG_TYPE_STR(elog_type));
+               rc = snprintf(newname, sizeof(newname), "%s-%s",
+                               oldname, ELOG_TYPE_STR(elog_type));
+               if (rc < 0 || rc >= sizeof(newname)) {
+                       syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, 
ELOG_TYPE_STR(elog_type));
+                       free(namelist[i]);
+                       continue;
+               }
 
                if (rename(oldname, newname) < 0) {
                        syslog(LOG_WARNING, "Couldn't rename logfile %s to "
@@ -705,8 +718,14 @@
                        continue;
                }
 
-               snprintf(elog_path, sizeof(elog_path), "%s/%s",
-                        elog_dir, dirent->d_name);
+               rc = snprintf(elog_path, sizeof(elog_path), "%s/%s",
+                               elog_dir, dirent->d_name);
+               if (rc < 0 || rc >= sizeof(elog_path)) {
+                       syslog(LOG_ERR, "%s:%d - Unable to format %s\n",
+                                       __func__, __LINE__, dirent->d_name);
+                       free(namelist[i]);
+                       continue;
+               }
 
                is_dir = 0;
 
@@ -1087,8 +1106,10 @@
                        if (rc > 0 && fds[UDEV_FD].revents) {
                                udev_dev = 
udev_monitor_receive_device(udev_mon);
                                devpath = udev_device_get_devpath(udev_dev);
-                               if (devpath && strrchr(devpath, '/'))
+                               if (devpath && strrchr(devpath, '/')) {
                                        strncpy(elog_str_name, strrchr(devpath, 
'/'), ELOG_STR_SIZE);
+                                       elog_str_name[sizeof(elog_str_name) - 
1] = '\0';
+                               }
                                udev_device_unref(udev_dev);
                                /* The id of the elog should be in elog_str_name
                                 * Perhaps more can be done with the udev 
information
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/opal_errd/run_tests 
new/ppc64-diag-2.7.8/opal_errd/run_tests
--- old/ppc64-diag-2.7.7/opal_errd/run_tests    2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/opal_errd/run_tests    2022-03-03 16:38:04.000000000 
+0100
@@ -8,6 +8,7 @@
 SYSFS_TEST_DIR=$TOP_LEVEL/opal_errd/sysfs-test/
 ALL_TESTS=$TOP_LEVEL/opal_errd/tests/*
 TEST_RESULTS=$TOP_LEVEL/opal_errd/tests-results
+PLAT_PREFIX=
 
 export OPAL_ERRD_DIR=$TOP_LEVEL/opal_errd
 export SYSFS=`mktemp -d --tmpdir ppc64-diag-run_tests.sysfs.XXXXXXXXXX`
@@ -79,9 +80,14 @@
        esac
 done
 
+grep -q pSeries /proc/cpuinfo && PLAT_PREFIX=".pseries"
+
 for the_test in $all_tests; do
        export CUR_TEST=$(basename $the_test)
-       export RESULT="$TEST_RESULTS/$CUR_TEST.result"
+       export RESULT="$TEST_RESULTS/$CUR_TEST.result$PLAT_PREFIX"
+       if [[ ! -f $RESULT.err ]] && [[ ! -f $RESULT.out ]] ; then
+               export RESULT="$TEST_RESULTS/$CUR_TEST.result"
+       fi
        if [[ $q -eq 1 ]] ; then
                source "$the_test"
        else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ppc64-diag-2.7.7/opal_errd/tests/test-extract_opal_dump-000 
new/ppc64-diag-2.7.8/opal_errd/tests/test-extract_opal_dump-000
--- old/ppc64-diag-2.7.7/opal_errd/tests/test-extract_opal_dump-000     
2021-04-30 10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/opal_errd/tests/test-extract_opal_dump-000     
2022-03-03 16:38:04.000000000 +0100
@@ -9,6 +9,9 @@
 
 run_binary "./extract_opal_dump" "-s $SYSFS -o $OUT"
 sed -e 's%/tmp/.*/%%;s/OPAL_DUMP\[[0-9]*\]/OPAL_DUMP[XXXX]/' -i $OUTSTDERR
+# On qemu pseries it prints PowerKVM Guest. Make travis CI happy
+sed -e 's/PowerKVM/PowerVM/' -i $OUTSTDERR
+sed -e 's/Guest/LPAR/' -i $OUTSTDERR
 
 ls -1 $OUT >> $OUTSTDOUT
 (cd $OUT; md5sum *) >> $OUTSTDOUT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/ppc64-diag-2.7.7/opal_errd/tests-results/test-extract_opal_dump-000.result.pseries.err
 
new/ppc64-diag-2.7.8/opal_errd/tests-results/test-extract_opal_dump-000.result.pseries.err
--- 
old/ppc64-diag-2.7.7/opal_errd/tests-results/test-extract_opal_dump-000.result.pseries.err
  1970-01-01 01:00:00.000000000 +0100
+++ 
new/ppc64-diag-2.7.8/opal_errd/tests-results/test-extract_opal_dump-000.result.pseries.err
  2022-03-03 16:38:04.000000000 +0100
@@ -0,0 +1 @@
+extract_opal_dump is not supported on the PowerVM pSeries LPAR platform
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/ppc64-diag.spec.in 
new/ppc64-diag-2.7.8/ppc64-diag.spec.in
--- old/ppc64-diag-2.7.7/ppc64-diag.spec.in     2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/ppc64-diag.spec.in     2022-03-03 16:38:04.000000000 
+0100
@@ -16,12 +16,12 @@
 BuildRequires: librtas-devel >= 1.4.0
 BuildRequires: ncurses-devel
 %if (0%{?fedora} || 0%{?rhel} || 0%{?centos})
-BuildRequires: libvpd-devel
+BuildRequires: libvpd-devel >= 2.2.9
 BuildRequires: systemd-devel
 %else
     %if 0%{?sle_version}
 BuildRequires: libudev-devel
-BuildRequires: libvpd2-devel
+BuildRequires: libvpd2-devel >= 2.2.9
     %endif
 %endif
 
@@ -123,6 +123,11 @@
 fi
 
 %changelog
+* Thu Mar 3  2022 - Mahesh Salgaonkar <mah...@linux.ibm.com> - 2.7.8
+- Update build dependency to use libvpd >= v2.2.9
+- Fix extract_opal_dump error message on unsupported platform
+- Fix build warning with GCC-8.5 and GCC-11
+
 * Fri Apr 30 2021 - Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - 2.7.7
 - Add travis build support
 - rtas_errd: Don't run the service in LXC
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/rtas_errd/convert_dt_node_props.c 
new/ppc64-diag-2.7.8/rtas_errd/convert_dt_node_props.c
--- old/ppc64-diag-2.7.7/rtas_errd/convert_dt_node_props.c      2021-04-30 
10:53:24.000000000 +0200
+++ new/ppc64-diag-2.7.8/rtas_errd/convert_dt_node_props.c      2022-03-03 
16:38:04.000000000 +0100
@@ -708,7 +708,8 @@
                                                drcname, DRC_NAME_LEN)) {
                                        fprintf(stderr, "could not find the "
                                                "drc-name corresponding to "
-                                               "drc-index 0x%08x\n", drcindex);
+                                               "drc-index 0x%08lx\n",
+                                               drc_tmp_idx);
                                        return 4;
                                }
                                printf("%s\n", drcname);
@@ -734,13 +735,20 @@
        int found=0, fd;
        char buffer[1024];
        uint32_t temp;
+       int rc;
 
        dir = opendir("/proc/device-tree/cpus");
 
        while (!found && (entry = readdir(dir)) != NULL) {
                if (!strncmp(entry->d_name, "PowerPC,POWER", 13)) {
-                       snprintf(buffer, 1024, "/proc/device-tree/cpus/%s/"
-                               "ibm,ppc-interrupt-server#s", entry->d_name);
+                       rc = snprintf(buffer, 1024, 
"/proc/device-tree/cpus/%s/ibm"
+                                               ",ppc-interrupt-server#s", 
entry->d_name);
+                       if (rc < 0 || rc >= 1024) {
+                               fprintf(stderr, "%s:%d - Unable to format %s\n",
+                                               __func__, __LINE__, 
entry->d_name);
+                               goto cleanup;
+                       }
+
                        if ((fd = open(buffer, O_RDONLY)) < 0) {
                                fprintf(stderr, "Error: error opening %s:\n"
                                        "%s\n", buffer, strerror(errno));
@@ -750,9 +758,13 @@
                        while (read_uint32(fd, &temp) == 0) {
                                if (temp == int_serv) {
                                        close(fd);
-                                       snprintf(buffer, 1024, "/proc/device-"
-                                               "tree/cpus/%s/ibm,my-drc-index",
-                                               entry->d_name);
+                                       rc = snprintf(buffer, 1024, 
"/proc/device-tree/cpus/%s/"
+                                                       "ibm,my-drc-index", 
entry->d_name);
+                                       if (rc < 0 || rc >= 1024) {
+                                               fprintf(stderr, "%s:%d - Unable 
to format %s\n",
+                                                               __func__, 
__LINE__, entry->d_name);
+                                               goto cleanup;
+                                       }
                                        if ((fd = open(buffer, O_RDONLY)) < 0) {
                                                fprintf(stderr, "Error "
                                                        "opening %s:\n%s\n",
@@ -785,6 +797,7 @@
        int intr_fd, drc_fd, found=0;
        char buffer[1024];
        uint32_t temp;
+       int rc;
 
        dir = opendir("/proc/device-tree/cpus");
        if (!dir)
@@ -792,8 +805,14 @@
 
        while (!found && (entry = readdir(dir)) != NULL) {
                if (!strncmp(entry->d_name, "PowerPC,POWER", 13)) {
-                       snprintf(buffer, 1024, "/proc/device-tree/cpus/%s/"
-                               "ibm,my-drc-index", entry->d_name);
+                       rc = snprintf(buffer, 1024, 
"/proc/device-tree/cpus/%s/ibm,my-drc-index",
+                                       entry->d_name);
+                       if (rc < 0 || rc >= 1024) {
+                               fprintf(stderr, "%s:%d - Unable to format %s\n",
+                                               __func__, __LINE__, 
entry->d_name);
+                               closedir(dir);
+                               return 0;
+                       }
                        if ((drc_fd = open(buffer, O_RDONLY)) < 0) {
                                fprintf(stderr, "Error opening %s:\n"
                                        "%s\n", buffer, strerror(errno));
@@ -803,10 +822,16 @@
 
                        while (read_uint32(drc_fd, &temp) == 0) {
                                if (temp == drc_idx) {
-                                       snprintf(buffer, 1024, "/proc/device-"
-                                               "tree/cpus/%s/"
-                                               "ibm,ppc-interrupt-server#s",
-                                               entry->d_name);
+                                       rc = snprintf(buffer, 1024, 
"/proc/device-tree/cpus/%s/"
+                                                       
"ibm,ppc-interrupt-server#s",
+                                                       entry->d_name);
+                                       if (rc < 0 || rc >= 1024) {
+                                               fprintf(stderr, "%s:%d - Unable 
to format %s\n",
+                                                               __func__, 
__LINE__, entry->d_name);
+                                               close(drc_fd);
+                                               closedir(dir);
+                                               return 0;
+                                       }
                                        if ((intr_fd = open(buffer, O_RDONLY)) 
< 0) {
                                                fprintf(stderr, "Error "
                                                        "opening %s:\n%s\n",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/rtas_errd/ela.c 
new/ppc64-diag-2.7.8/rtas_errd/ela.c
--- old/ppc64-diag-2.7.7/rtas_errd/ela.c        2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/rtas_errd/ela.c        2022-03-03 16:38:04.000000000 
+0100
@@ -2071,10 +2071,10 @@
                                e_desc->rcode = 0x30;
                        } else {
                                e_desc = volt_epow;
-                               strncpy(e_desc->frus[0].fname, fru_name,
+                               memcpy(e_desc->frus[0].fname, fru_name,
                                                                NAMESIZE - 1);
                                e_desc->frus[0].fname[NAMESIZE - 1] = '\0';
-                               strncpy(e_desc->frus[1].fname, sensor_name,
+                               memcpy(e_desc->frus[1].fname, sensor_name,
                                                                NAMESIZE - 1);
                                e_desc->frus[1].fname[NAMESIZE - 1] = '\0';
                                e_desc->rcode = 0x831;
@@ -2090,7 +2090,7 @@
                                e_desc->rcode = 0x50;
                        } else {
                                e_desc = therm_epow;
-                               strncpy(e_desc->frus[0].fname, sensor_name,
+                               memcpy(e_desc->frus[0].fname, sensor_name,
                                                                NAMESIZE - 1);
                                e_desc->frus[0].fname[NAMESIZE - 1] = '\0';
                                e_desc->rcode = 0x832;
@@ -2108,10 +2108,10 @@
                                e_desc->rcode = 0x70;
                        } else {
                                e_desc = pow_epow;
-                               strncpy(e_desc->frus[0].fname, fru_name,
+                               memcpy(e_desc->frus[0].fname, fru_name,
                                                                NAMESIZE - 1);
                                e_desc->frus[0].fname[NAMESIZE - 1] = '\0';
-                               strncpy(e_desc->frus[1].fname, sensor_name,
+                               memcpy(e_desc->frus[1].fname, sensor_name,
                                                                NAMESIZE - 1);
                                e_desc->frus[1].fname[NAMESIZE - 1] = '\0';
                                e_desc->rcode = 0x833;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/rtas_errd/guard.c 
new/ppc64-diag-2.7.8/rtas_errd/guard.c
--- old/ppc64-diag-2.7.7/rtas_errd/guard.c      2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/rtas_errd/guard.c      2022-03-03 16:38:04.000000000 
+0100
@@ -141,6 +141,7 @@
        struct dirent *entry;
        int ret_val, fd, ctr=0;
        char buffer[1024], state[7];
+       int rc;
 
        ret_val = 0; /* default state is false, unless count is positive */
 
@@ -156,8 +157,13 @@
 
                if (!strncmp(entry->d_name, "memory", 6)) {
 
-                       snprintf(buffer, 1024, "/sys/devices/system/memory/%s/"
-                               "state", entry->d_name);
+                       rc = snprintf(buffer, 1024, 
"/sys/devices/system/memory/%s/"
+                                       "state", entry->d_name);
+                       if (rc < 0 || rc >= 1024) {
+                               log_msg(NULL, "%s:%d - Unable to format %s\n",
+                                               __func__, __LINE__, 
entry->d_name);
+                               continue;
+                       }
 
                        if ((fd = open(buffer, O_RDONLY)) < 0 ) {
                                log_msg(NULL, "Could not open %s, %s",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/ppc64-diag-2.7.7/rtas_errd/servicelog.c 
new/ppc64-diag-2.7.8/rtas_errd/servicelog.c
--- old/ppc64-diag-2.7.7/rtas_errd/servicelog.c 2021-04-30 10:53:24.000000000 
+0200
+++ new/ppc64-diag-2.7.8/rtas_errd/servicelog.c 2022-03-03 16:38:04.000000000 
+0100
@@ -268,13 +268,11 @@
                        free(event->sl_entry->description);
                        event->sl_entry->description = new_desc;
                } else {
-                       event->sl_entry->description = malloc(txtlen+1);
+                       event->sl_entry->description = strdup(event->addl_text);
                        if (event->sl_entry->description == NULL) {
                                log_msg(event, "Memory allocation failed");
                                return;
                        }
-                       snprintf(event->sl_entry->description, txtlen,
-                                "%s", event->addl_text);
                }
        }
 

Reply via email to