From 05c8afe42559c98f89022431e457bfbdaf01c806 Mon Sep 17 00:00:00 2001 From: Pierre-Louis Bossart Date: Mon, 5 Aug 2019 19:55:06 -0500 Subject: soundwire: intel: prevent possible dereference in hw_params This should not happen in production systems but we should test for all callback arguments before invoking the config_stream callback. Update the prototype to clarify that the first argument is mandatory. Also use local variable instead of multiple dereferences to improve readability. Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20190806005522.22642-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Vinod Koul --- include/linux/soundwire/sdw_intel.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/linux') diff --git a/include/linux/soundwire/sdw_intel.h b/include/linux/soundwire/sdw_intel.h index 4d70da45363d..c9427cb6020b 100644 --- a/include/linux/soundwire/sdw_intel.h +++ b/include/linux/soundwire/sdw_intel.h @@ -8,6 +8,7 @@ * struct sdw_intel_ops: Intel audio driver callback ops * * @config_stream: configure the stream with the hw_params + * the first argument containing the context is mandatory */ struct sdw_intel_ops { int (*config_stream)(void *arg, void *substream, -- cgit v1.2.3-73-gaa49b