I looked up 大丈夫{だいじょうぶ} in a Japanese dictionary and the first entry reads:
危険{きけん}や心配{しんぱい}のないさま。間違い{まちがい}がないさま。
Why is it that, in the first definition, the subject (危険や心配) seems to be marked by の, while the subject in the second definition (間違い) is marked by が? Although I seem to encounter this usage in real Japanese quite a bit, I can't find anything explicitly saying that の can be used as a subject marker.
At first, I assumed that の is used to mark the subject of an attributive verb clause, and が is used to mark the subject of a predicative clause. Reading this dictionary entry debunked that, however, because the verb clause in the second definition is also attributive (i.e. it's modifying the noun さま), although it's marked by が.
Are there rules to follow in order to choose correctly between の and が? Is it merely a matter of preference, or would it actually be grammatically incorrect to say 「危険や心配がないさま」?