@@ -234,46 +234,42 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
234234 off_t tableAddress = 0 ;
235235 FF_AUTO_CLOSE_FD int fd = open ("/dev/misc/mem" , O_RDONLY );
236236 if (fd < 0 )
237- { perror ( "open(mem)" ); return NULL ;}
237+ return NULL ;
238238 FF_AUTO_FREE uint8_t * smBiosBase = malloc (0x10000 );
239239 if (pread (fd , smBiosBase , 0x10000 , 0xF0000 ) != 0x10000 )
240- { perror ( "pread(fd)" ); return NULL ;}
241- puts ( "read(mem) ok" );
240+ return NULL ;
241+
242242 for (off_t offset = 0 ; offset <= 0xffe0 ; offset += 0x10 )
243243 {
244244 FFSmbiosEntryPoint * p = (void * )(smBiosBase + offset );
245245 if (memcmp (p , "_SM3_" , sizeof (p -> Smbios30 .AnchorString )) == 0 )
246246 {
247- puts ("found SM3" );
248247 if (p -> Smbios30 .EntryPointLength != sizeof (p -> Smbios30 ))
249- { puts ( "invalid sm3 entry length" ); return NULL ;}
248+ return NULL ;
250249 tableLength = p -> Smbios30 .StructureTableMaximumSize ;
251250 tableAddress = (off_t ) p -> Smbios30 .StructureTableAddress ;
252251 break ;
253252 }
254253 else if (memcmp (p , "_SM_" , sizeof (p -> Smbios20 .AnchorString )) == 0 )
255254 {
256- puts ("found SM2" );
257255 if (p -> Smbios20 .EntryPointLength != sizeof (p -> Smbios20 ))
258- {
259- puts ("invalid sm2 entry length" );return NULL ;}
256+ return NULL ;
260257 tableLength = p -> Smbios20 .StructureTableLength ;
261258 tableAddress = (off_t ) p -> Smbios20 .StructureTableAddress ;
262259 break ;
263260 }
264261 }
265262 if (tableLength == 0 )
266- { puts ( "nothing found" ); return NULL ;}
267- printf ( "found table length: %d\n" , ( int ) tableLength );
263+ return NULL ;
264+
268265 ffStrbufEnsureFixedLengthFree (& buffer , tableLength );
269266 if (pread (fd , buffer .chars , tableLength , tableAddress ) == tableLength )
270267 {
271- puts ("pread(table) done" );
272268 buffer .length = tableLength ;
273269 buffer .chars [buffer .length ] = '\0' ;
274270 }
275271 else
276- { perror ( "pread(table)" ); return NULL ;}
272+ return NULL ;
277273 }
278274 #endif
279275
@@ -293,8 +289,6 @@ const FFSmbiosHeaderTable* ffGetSmbiosHeaderTable()
293289 }
294290 }
295291
296- puts ("Everything is ok" );
297-
298292 return & table ;
299293}
300294#elif defined(_WIN32 )
0 commit comments