• Laurent Pinchart's avatar
    media: Zero-initialize all structures passed to subdev pad operations · ecefa105
    Laurent Pinchart authored
    Several drivers call subdev pad operations, passing structures that are
    not fully zeroed. While the drivers initialize the fields they care
    about explicitly, this results in reserved fields having uninitialized
    values. Future kernel API changes that make use of those fields thus
    risk breaking proper driver operation in ways that could be hard to
    detect.
    
    To avoid this, make the code more robust by zero-initializing all the
    structures passed to subdev pad operation. Maintain a consistent coding
    style by preferring designated initializers (which zero-initialize all
    the fields that are not specified) over memset() where possible, and
    make variable declarations local to inner scopes where applicable. One
    notable exception to this rule is in the ipu3 driver, where a memset()
    is needed as the structure is not a local variable but a function
    parameter provided by the caller.
    
    Not all fields of those structures can be initialized when declaring...
    ecefa105
camss-video.c 30.8 KB