Return value of strlcpy() is not checked. Name string is silently
truncated if longer that SPI_NAME_SIZE, whilst not detrimental to
the program logic it would be nice to notify the user. Module is
currently quite verbose, adding extra pr_warn() calls will not overly
impact this verbosity.
Check return value from call to strlcpy(). If source string is
truncated call pr_warn() to notify user.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
                        displays[i].pdev->name = name;
                        displays[i].spi = NULL;
                } else {
-                       strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE);
+                       size_t len;
+
+                       len = strlcpy(displays[i].spi->modalias, name,
+                               SPI_NAME_SIZE);
+                       if (len >= SPI_NAME_SIZE)
+                               pr_warn("modalias (name) truncated to: %s\n",
+                                       displays[i].spi->modalias);
                        displays[i].pdev = NULL;
                }
        }