check buffer size when allocating dmesg memroy