summaryrefslogtreecommitdiffstats
path: root/lib/packing_test.c
diff options
context:
space:
mode:
authorVladimir Oltean <vladimir.oltean@nxp.com>2024-12-10 12:27:11 -0800
committerJakub Kicinski <kuba@kernel.org>2024-12-11 20:12:59 -0800
commit48c2752785ad1730e08a64507f05d0e5d5bc79b8 (patch)
tree7f5a9a2dd41464dd700f3e1b64ee1ff06c675b22 /lib/packing_test.c
parentc4117091d029087abde76e6947d43dca8f1db20b (diff)
downloadlinux-stable-48c2752785ad1730e08a64507f05d0e5d5bc79b8.tar.gz
linux-stable-48c2752785ad1730e08a64507f05d0e5d5bc79b8.tar.bz2
linux-stable-48c2752785ad1730e08a64507f05d0e5d5bc79b8.zip
lib: packing: demote truncation error in pack() to a warning in __pack()
Most of the sanity checks in pack() and unpack() can be covered at compile time. There is only one exception, and that is truncation of the uval during a pack() operation. We'd like the error-less __pack() to catch that condition as well. But at the same time, it is currently the responsibility of consumer drivers (currently just sja1105) to print anything at all when this error occurs, and then discard the return code. We can just print a loud warning in the library code and continue with the truncated __pack() operation. In practice, having the warning is very important, see commit 24deec6b9e4a ("net: dsa: sja1105: disallow C45 transactions on the BASE-TX MDIO bus") where the bug was caught exactly by noticing this print. Add the first print to the packing library, and at the same time remove the print for the same condition from the sja1105 driver, to avoid double printing. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20241210-packing-pack-fields-and-ice-implementation-v10-2-ee56a47479ac@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'lib/packing_test.c')
0 files changed, 0 insertions, 0 deletions