Message ID | 20220609211130.5108-6-logang@deltatee.com (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | Bug fixes and testing improvments | expand |
On Thu, 9 Jun 2022 15:11:21 -0600 Logan Gunthorpe <logang@deltatee.com> wrote: > Not all struct superswitch implement a get_bad_blocks() function, > yet mdmon seems to call it without checking for NULL and thus > occasionally segfaults in the test 10ddf-geometry. > > Fix this by checking for NULL before calling it. > > Signed-off-by: Logan Gunthorpe <logang@deltatee.com> > --- Acked-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
diff --git a/monitor.c b/monitor.c index b877e595c998..820a93d0ceaf 100644 --- a/monitor.c +++ b/monitor.c @@ -311,6 +311,9 @@ static int check_for_cleared_bb(struct active_array *a, struct mdinfo *mdi) struct md_bb *bb; int i; + if (!ss->get_bad_blocks) + return -1; + /* * Get a list of bad blocks for an array, then read list of * acknowledged bad blocks from kernel and compare it against metadata
Not all struct superswitch implement a get_bad_blocks() function, yet mdmon seems to call it without checking for NULL and thus occasionally segfaults in the test 10ddf-geometry. Fix this by checking for NULL before calling it. Signed-off-by: Logan Gunthorpe <logang@deltatee.com> --- monitor.c | 3 +++ 1 file changed, 3 insertions(+)